]> git.donarmstrong.com Git - lilypond.git/blob - scripts/build/make-version.py
Remove StepMake as a separate package
[lilypond.git] / scripts / build / make-version.py
1 #!@PYTHON@
2 import re
3 import sys
4
5 PROGRAM = sys.argv[0]
6 VERSION = sys.argv[1]
7 defs = []
8 for i in open (VERSION).readlines ():
9     i = re.sub ('#.*','', i)
10     m  = re.search ('([^ =]*)[\t ]*=[ \t]*([^ \t]*)[ \t]*\n', i)
11     if m:
12         defs.append ((m.group (1), m.group (2)))
13
14 sys.stdout.write (r'''
15 /*
16  Automatically generated from %(VERSION)s
17  by %(PROGRAM)s.
18 */
19 #ifndef VERSION_HH
20 #define VERSION_HH
21 ''' % vars ())
22
23 for name, expansion in defs:
24     # GUILE leaks autoconf data into userspace. 
25     sys.stdout.write (r'''
26 #ifdef %(name)s
27 #undef %(name)s
28 #endif /* %(name)s */
29 #define %(name)s "%(expansion)s"
30 ''' % vars ())
31     
32 if ('MY_PATCH_LEVEL', '') in defs:
33     sys.stdout.write (r'''
34 #define NO_MY_PATCHLEVEL
35 #define TOPLEVEL_VERSION MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL
36 ''')
37 else:
38     sys.stdout.write (r'''
39 #define TOPLEVEL_VERSION MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL "." MY_PATCH_LEVEL
40 ''')
41
42 sys.stdout.write(r'''
43 #endif /* VERSION_HH */
44 ''')
45