]> git.donarmstrong.com Git - lilypond.git/commitdiff
Update makelsr.py script to include the input/tolsr/ subdirs.
authorGraham Percival <graham@percival-music.ca>
Thu, 19 Apr 2007 08:35:56 +0000 (01:35 -0700)
committerGraham Percival <graham@percival-music.ca>
Thu, 19 Apr 2007 08:35:56 +0000 (01:35 -0700)
buildscripts/makelsr.py

index f6e1c42629d1b72a87ee8a4376b3e8aa8e86d082..5f56d4b5831b226ca52f3e1c1f0a02355505f6e6 100755 (executable)
@@ -4,7 +4,6 @@ import os
 import os.path
 import shutil
 
-# 'expressive' not available yet
 dirs = ['ancient','chords','connecting','contemporary','expressive','guitar','parts','repeats','spacing','staff','text','vocal']
 notsafe=[]
 
@@ -18,6 +17,20 @@ 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):
+       if not(os.path.exists(srcdir)):
+               return
+       file_names = os.listdir (srcdir)
+       for file in file_names:
+               src = os.path.join (srcdir, file)
+               dest = os.path.join (destdir, file)
+               copy_with_warning(src, dest)
+               s = os.system('lilypond -dsafe -dbackend=svg -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)
@@ -26,22 +39,18 @@ 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) )
 
-       file_names = os.listdir (in_dir + dir)
-       for file in file_names:
-               src = os.path.join (srcdir, file)
-               dest = os.path.join (destdir, file)
-               copy_with_warning(src, dest)
-#              shutil.copyfile (src, dest)
-               s = os.system('lilypond -dsafe -dbackend=svg -o /tmp/lsrtest ' + dest)
-               if s:
-                       notsafe.append(dest)
-                       #raise 'Failed'
+       ## 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', 'tolsr', dir), destdir )
+
 
 file=open("lsr-unsafe.txt", 'w')
 for s in notsafe:
@@ -50,7 +59,7 @@ file.close()
 print
 print
 print "Unsafe files printed in lsr-unsafe.txt: CHECK MANUALLY!"
-print "  (probably with  xargs git-diff < lsr-unsafe.txt  )"
+print "  xargs git-diff < lsr-unsafe.txt"
 print