4 # lily-python.py -- implement general LilyPond-wide python stuff
6 # source file of the GNU LilyPond music typesetter
8 # (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
24 make_assign_re
= regex
.compile('^\([A-Z_]*\) *= *\(.*\)$')
26 def version_str_tuple(file):
27 lines
= file.readlines()
29 mi
= pa
= mp
= mj
= ''
32 if make_assign_re
.search(l
) <> -1:
33 nm
= make_assign_re
.group(1)
34 val
= make_assign_re
.group(2)
35 if nm
== 'TOPLEVEL_MAJOR_VERSION':
37 elif nm
== 'TOPLEVEL_MINOR_VERSION':
39 elif nm
== 'TOPLEVEL_PATCH_LEVEL':
41 elif nm
== 'TOPLEVEL_MY_PATCH_LEVEL':
48 self
.topdir
= os
.environ
['LILYPOND_SOURCEDIR'] + '/'
50 self
.topdir
= os
.environ
['HOME'] + 'musix/current'
52 self
.release_dir
= self
.topdir
+ '../releases/'
53 self
.patch_dir
= self
.topdir
+ '../patches/'
55 def version_str_tuple(self
):
56 f
= open (self
.topdir
+ 'VERSION')
57 v
= version_str_tuple(f
)
63 print lilydirs
.version_str_tuple()