Minor regtest correction.
[lilypond.git] / stepmake / bin / make-version.py
blob61247fb8aac30ed6515d6e18a914efda94773f1d
2 import re
3 import sys
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)))
14 sys.stdout.write (r'''
16 Automatically generated from %(VERSION)s
17 by %(PROGRAM)s.
19 #ifndef VERSION_HH
20 #define VERSION_HH
21 ''' % vars ())
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 ())
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 ''')
42 sys.stdout.write(r'''
43 #endif /* VERSION_HH */
44 ''')