]> git.donarmstrong.com Git - lilypond.git/blob - buildscripts/makelsr.py
Merge branch 'master' of ssh://jomand@git.sv.gnu.org/srv/git/lilypond into topic...
[lilypond.git] / buildscripts / makelsr.py
1 #!/usr/bin/python
2 import sys
3 import os
4 import os.path
5 import shutil
6
7 # 'expressive' not available yet
8 dirs = ['ancient','chords','connecting','contemporary','expressive','guitar','parts','repeats','spacing','staff','text','vocal']
9 notsafe=[]
10
11 try:
12         in_dir = sys.argv[1]
13 except:
14         print "Please specify input_file."
15         sys.exit()
16
17 def copyWithWarning(src, dest):
18         readFile = open(src, 'r')
19         readFileLines = readFile.readlines()
20         readFile.close()
21         writeFile = open(dest, 'w')
22         writeFile.write('%%  Do not edit this file; it is auto-generated from LSR!\n')
23         for line in readFileLines:
24                 writeFile.write(line)
25         writeFile.close()
26
27 for dir in dirs:
28         srcdir = os.path.join (in_dir, dir)
29         destdir = os.path.join ('input', 'lsr', dir)
30         if not(os.path.isdir(destdir)):
31                 print "Please run this script from the head of the source tree,"
32                 print "  and/or check that you have the right categories."
33                 sys.exit()
34
35         file_names = os.listdir (destdir)
36         for file in file_names:
37                 if (file.endswith ('.ly')):
38                         if (file[:3] != 'AAA'):
39                                 os.remove( os.path.join(destdir,file) )
40
41         file_names = os.listdir (in_dir + dir)
42         for file in file_names:
43                 src = os.path.join (srcdir, file)
44                 dest = os.path.join (destdir, file)
45                 copyWithWarning(src, dest)
46 #               shutil.copyfile (src, dest)
47                 s = os.system('lilypond -dsafe -dbackend=svg -o /tmp/lsrtest ' + dest)
48                 if s:
49                         notsafe.append(dest)
50                         #raise 'Failed'
51
52 file=open("lsr-unsafe.txt", 'w')
53 for s in notsafe:
54         file.write(s+'\n')
55 file.close()
56 print
57 print
58 print "Unsafe files printed in lsr-unsafe.txt: CHECK MANUALLY!"
59 print "  (probably with  xargs git-diff < lsr-unsafe.txt  )"
60 print
61
62