File: make-version.py

package info (click to toggle)
lilypond 2.2.6-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 11,260 kB
  • ctags: 7,622
  • sloc: cpp: 47,787; lisp: 11,217; python: 11,203; sh: 3,290; yacc: 2,011; lex: 831; perl: 373; ansic: 309; makefile: 132; csh: 8
file content (44 lines) | stat: -rw-r--r-- 741 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

import re
import sys


vf = 'VERSION'
if sys.argv[1:]:
	vf = sys.argv[1]

f = open (vf)
ls = f.readlines ()
mypatch = 0
defs = []
for l in ls:
	l = re.sub ('#.*','', l)
	m  = re.search ('([^ =]*)[\t ]*=[ \t]*([^ \t]*)[ \t]*\n', l)
	if m:
		defs.append ((m.group(1), m.group(2)))


sys.stdout.write (r'''
#ifndef VERSION_HH
#define VERSION_HH
/* automatically generated */


''')
for d in defs:

	# GUILE leaks autoconf data into userspace. 
	sys.stdout.write ('#ifdef %s\n' % d[0])
	sys.stdout.write ('#undef %s\n' % d[0])
	sys.stdout.write ('#endif /* %s */\n' % d[0])		
	
	sys.stdout.write ('#define %s "%s"\n' % d)
	

if ('MY_PATCH_LEVEL', '') in defs:
	sys.stdout.write ('#define NO_MY_PATCHLEVEL')

sys.stdout.write(r'''
#endif
''')