X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fmakelsr.py;h=a2c24e70181e984f69d8a22f22643a0b172fc2a2;hb=4790df2a2c3cdcd14479e8ece60a99ab803f6197;hp=3f708272992adb3ee2dafc7e11763a21c1e28b7d;hpb=39e7a8e9833986f4cb6bbf1767aa4d86d5b672e0;p=lilypond.git diff --git a/buildscripts/makelsr.py b/buildscripts/makelsr.py index 3f70827299..a2c24e7018 100755 --- a/buildscripts/makelsr.py +++ b/buildscripts/makelsr.py @@ -4,7 +4,8 @@ import os import os.path import shutil -dirs = ['advanced','trick'] +dirs = ['ancient','chords','connecting','contemporary','expressive','education','guitar','parts','pitch','repeats','scheme','spacing','staff','text','vocal','other','nonmusic','engravers','instrument'] +notsafe=[] try: in_dir = sys.argv[1] @@ -12,6 +13,33 @@ except: print "Please specify input_file." sys.exit() +def copy_with_warning(src, dest): + msg = '%% Do not edit this file; it is auto-generated from LSR!\n' + open (dest, 'w').write( msg + open (src).read() ) + + +def copy_dir_with_test(srcdir, destdir): + global notsafe + global notconvert + if not(os.path.exists(srcdir)): + return + file_names = os.listdir (srcdir) + for file in file_names: + if (file.endswith ('.ly')): + src = os.path.join (srcdir, file) + destname = file.replace (';', '-') + dest = os.path.join (destdir, destname) + copy_with_warning(src, dest) + os.system('convert-ly -e ' + dest) + if os.path.exists( dest + '~' ): + os.remove( dest + '~' ) + # the -V seems to make unsafe snippets fail nicer/sooner. + s = os.system('nice lilypond -V -dno-print-pages -dsafe -o /tmp/lsrtest ' + dest) + #s = os.system('nice lilypond -dno-print-pages -dsafe -o /tmp/lsrtest ' + dest) + if s: + notsafe.append(dest) + + for dir in dirs: srcdir = os.path.join (in_dir, dir) destdir = os.path.join ('input', 'lsr', dir) @@ -20,15 +48,25 @@ for dir in dirs: print " and/or check that you have the right categories." sys.exit() + ## clean out existing files file_names = os.listdir (destdir) for file in file_names: if (file.endswith ('.ly')): - if (file[:3] != 'AAA'): - os.remove( os.path.join(destdir,file) ) + os.remove( os.path.join(destdir,file) ) + ## copy in new files from LSR download + copy_dir_with_test( srcdir, destdir ) + ## copy in new files in source tree + copy_dir_with_test( os.path.join ('input', 'new', dir), destdir ) - file_names = os.listdir (in_dir + dir) - for file in file_names: - src = os.path.join (srcdir, file) - dest = os.path.join (destdir, file) - shutil.copyfile (src, dest) + +file=open("lsr-unsafe.txt", 'w') +for s in notsafe: + file.write(s+'\n') +file.close() + +print +print +print "Unsafe files printed in lsr-unsafe.txt: CHECK MANUALLY!" +print " xargs git-diff < lsr-unsafe.txt" +print