From a9bb6e6a557612484fecc03517a7f89f0f20bbc5 Mon Sep 17 00:00:00 2001 From: Francisco Redondo Marchena Date: Tue, 5 Aug 2014 15:51:33 +0000 Subject: WIP: fix clusters --- scripts/migrate-chunks | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/migrate-chunks b/scripts/migrate-chunks index 8faee493..90f5b7c0 100755 --- a/scripts/migrate-chunks +++ b/scripts/migrate-chunks @@ -35,49 +35,49 @@ def move_morphs(morphs, kind): if kind == 'cluster': print 'Moving %s into subdirectory' % kind subdir = os.path.join(definitions_repo, 'cluster') - subprocess.call(['mkdir','-p', subdir]) + subprocess.call(['mkdir', '-p', subdir]) for morph in morphs: - print 'Initial: %s' % str(morph) - morph['systems'][0]['morph'] = str( 'systems/' + morph['systems'][0]['morph'] + '.morph') - new_morph = loader.parse_morphology_text(str(morph), morph.filename) - loader.save_to_file(morph.filename,new_morph) + for m in morph['systems']: + m['morph'] = str('systems/' + m['morph'] + '.morph') + #loader.save_to_file(morph.filename, morph) new_location = os.path.join(subdir, morph.filename) - subprocess.call(['git', 'mv', morph.filename, new_location]) + loader.save_to_file(morph.filename, morph) + #subprocess.call(['git', 'mv', morph.filename, new_location]) + sys.exit(0) #morph.filename = new_location #subprocess.call(['git', 'commit', '--quiet', '-m', # 'Move %s into subdirectory' %kind]) if kind == 'system': print 'Moving %s into subdirectory' % kind subdir = os.path.join(definitions_repo, 'system') - subprocess.call(['mkdir','-p', subdir]) + subprocess.call(['mkdir', '-p', subdir]) for morph in morphs: #print 'Initial: %s' % str(morph) for stratum in morph['strata']: stratum['morph'] = str('strata/' + stratum['morph'] + '.morph') - new_morph = loader.parse_morphology_text(str(morph), morph.filename) - loader.save_to_file(morph.filename,new_morph) + loader.save_to_file(morph.filename,morph) new_location = os.path.join(subdir, morph.filename) subprocess.call(['git', 'mv', morph.filename, new_location]) #morph.filename = new_location #subprocess.call(['git', 'commit', '--quiet', '-m', # 'Move %s into subdirectory' %kind]) - sys.exit(0) - for morph in morphs: - print '%s' %morph - str_morph = str(morph) - new_morph = loader.parse_morphology_text(str_morph, morph.filename) - new_location = os.path.join(subdir, morph.filename.replace('-' + kind,'',1)) - loader.save_to_file(new_location,new_morph) - print '%s' % new_location - sys.exit(0) + sys.exit(0) + + #for morph in morphs: +# print '%s' %morph +# str_morph = str(morph) +# new_morph = loader.parse_morphology_text(str_morph, morph.filename) +# new_location = os.path.join(subdir, morph.filename.replace('-' + kind,'',1)) +# loader.save_to_file(new_location,new_morph) +# print '%s' % new_location +# sys.exit(0) #subprocess.call(['git', 'mv', morph.filename, new_location]) #morph.filename = new_location #subprocess.call(['git', 'commit', '--quiet', '-m', # 'Move %s into subdirectory' % kind]m for key in morphologies.iterkeys(): - if key in ['system', 'cluster'] : - move_morphs(morphologies[key], key) + move_morphs(morphologies[key], key) #move_morphs(chunks, 'chunks') #move_morphs(strata, 'strata') -- cgit v1.2.1