Add scripts/auxiliar/update-patch-version
[lilypond/mpolesky.git] / scripts / build / create-version-itexi.py
blobe40ff6e79b0868c210c83b24089ba2347b1965ca
1 #!@PYTHON@
2 # create-version-itexi.py
4 """ when being called on lilypond.org, pass it the location of the
5 top source dir on the command-line. """
7 import sys
8 import os
9 import glob
13 # FIXME: if the depth depends on the type of build, figure it
14 # out automatically.
15 ### just like depth in our GNUmakefiles
16 # these links are relative from /~graham/web/
17 depth = "../../"
18 # these links are relative from the v2.13 docs
19 #depth = "../../../../"
23 VERSION_STABLE = ""
24 VERSION_DEVEL = ""
26 try:
27 topDir = sys.argv[1]
28 except:
29 myDir = os.path.dirname(sys.argv[0])
30 # use two abspaths to work around some windows python bug
31 topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
32 topDir = os.path.abspath( topDir )
35 # TODO: this might be useful for other scripts; can we make it available?
36 manuals = map(lambda x: os.path.splitext(x)[0],
37 map(os.path.basename,
38 glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
39 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
40 manuals.append('internals')
43 version_file_path = os.path.join(topDir, "VERSION")
45 version_contents = open(version_file_path).readlines()
46 major = 0
47 minor = 0
48 patch = 0
49 for line in version_contents:
50 if (line.startswith('MAJOR_VERSION')):
51 major = line[14:-1]
52 if (line.startswith('MINOR_VERSION')):
53 minor = line[14:-1]
54 if (line.startswith('PATCH_LEVEL')):
55 patch = line[12:-1]
56 if (line.startswith('VERSION_STABLE')):
57 VERSION_STABLE = line[15:-1]
58 if (line.startswith('VERSION_DEVEL')):
59 VERSION_DEVEL = line[14:-1]
61 VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
63 def make_macro(name, string):
64 print "@macro", name
65 print string
66 print "@end macro"
67 print ""
69 print "@c ************************ Version numbers ************"
70 make_macro("version", VERSION)
71 make_macro("versionStable", VERSION_STABLE)
72 make_macro("versionDevel", VERSION_DEVEL)