8 lilypath = os.environ['LILYPOND_SOURCEDIR'] + '/'
10 lilypath = os.environ['HOME'] + 'musix/current'
11 lilypath = lilypath + '/bin/'
12 sys.path.append(lilypath)
15 from lilypython import *
24 self.to_version = lilydirs.version_tuple()
25 self.from_version = prev_version(self.to_version)
32 'Generate a patch to go to this version.\n'
33 ' --from=FROM, -f FROM old is FROM\n'
34 ' --to=TO, -t TO to version TO\n'
42 sys.stderr.write('untarring ' + fn)
43 # can't seem to fix errors:
44 # gzip: stdout: Broken pipe
45 # tar: Child returned status 1
46 # os.system ('tar xzf ' + fn)
47 # sys.stderr.write('\n')
48 # ugh, even this does not work, but one error message less :-)
49 os.system ('gzip --quiet -dc ' + fn + '| tar xf - ')
50 # so print soothing message:
51 sys.stderr.write('make-patch:ugh: Please ignore error: gzip: stdout: Broken pipe\n');
55 header = 'Generated by make-patch, old = %s, new = %s\n\
59 cd lilypond-source-dir; patch -E -p0 < %s\n\
61 Patches do not contain automatically generated files, \n\
62 i.e. you should rerun configure\n\n'
64 pats = ['*.lsm', 'configure', '*.txt', 'lilypond.spec']
65 def remove_automatic(dirnames):
67 files = files + multiple_find(pats, dirnames)
72 def makepatch(fv, tv, patfile_nm):
74 prev_cwd = os.getcwd();
76 untar(released_tarball(fv))
77 untar(released_tarball(tv))
78 remove_automatic([dirname(fv), dirname(tv)])
83 patfile_nm = '../patch-%s' % version_tuple_to_str(tv)
85 f = open(patfile_nm, 'w')
87 (version_tuple_to_str(fv), version_tuple_to_str(tv), \
88 os.path.basename(patfile_nm)))
91 sys.stderr.write('diffing to %s... ' % patfile_nm)
92 os.system('diff -urN ../%s . >> %s' % (dirname(fv), patfile_nm))
93 #os.system('gzip -9f %s' % patfile_nm)
96 sys.stderr.write('cleaning ... ')
97 os.system('rm -fr %s %s' % (dirname(tv), dirname(fv)))
98 sys.stderr.write('\n')
102 sys.stderr.write('This is make-patch version %s\n' % mp_version)
103 (cl_options, files) = getopt.getopt(sys.argv[1:],
104 'hf:o:t:', ['output=', 'help', 'from=', 'to='])
106 for opt in cl_options:
109 if o == '--from' or o == '-f':
110 options.from_version = version_str_to_tuple(a)
111 elif o == '--to' or o == '-t':
112 options.to_version = version_str_to_tuple(a)
113 elif o== '--help' or o == '-h':
116 elif o == '--output' or o == '-o':
117 outfn = os.path.join(os.getcwd(), a)
122 pn = 'patch-%s' % version_tuple_to_str(options.to_version)
123 outfn = os.path.join(os.getcwd(), pn)
125 makepatch(options.from_version, options.to_version, outfn)
127 if __name__ == '__main__':