]> git.donarmstrong.com Git - lilypond.git/blob - scripts/build/create-version-itexi.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / build / create-version-itexi.py
1 #!@PYTHON@
2 # create-version-itexi.py
3
4 """ when being called on lilypond.org, pass it the location of the
5 top source dir on the command-line. """
6
7 import sys
8 import os
9 import glob
10
11
12
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 = "../../../../"
20
21
22
23 VERSION_STABLE = ""
24 VERSION_DEVEL = ""
25
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 )
33
34
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')
41
42
43 version_file_path = os.path.join(topDir, "VERSION")
44
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]
60
61 VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
62
63 def make_macro(name, string):
64     print "@macro", name
65     print string
66     print "@end macro"
67     print ""
68
69 print "@c This file was autogenerated"
70 print "@c     from: VERSION"
71 print "@c     by:   %s" % sys.argv[0]
72 print ""
73 print "@c ************************ Version numbers ************"
74 print ""
75
76 make_macro("version", VERSION)
77 make_macro("versionStable", VERSION_STABLE)
78 make_macro("versionDevel", VERSION_DEVEL)
79
80 print "@c *****************************************************"