OLD | NEW |
1 #!@PYTHON@ | 1 #!@PYTHON@ |
2 # create-version-itexi.py | 2 # create-version-itexi.py |
3 | 3 |
4 """ when being called on lilypond.org, pass it the location of the | 4 """ when being called on lilypond.org, pass it the location of the |
5 top source dir on the command-line. """ | 5 top source dir on the command-line. """ |
6 | 6 |
7 import sys | 7 import sys |
8 import os | 8 import os |
9 import glob | 9 import glob |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 try: | 26 try: |
27 topDir = sys.argv[1] | 27 topDir = sys.argv[1] |
28 except: | 28 except: |
29 myDir = os.path.dirname(sys.argv[0]) | 29 myDir = os.path.dirname(sys.argv[0]) |
30 # use two abspaths to work around some windows python bug | 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) | 31 topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep) |
32 topDir = os.path.abspath( topDir ) | 32 topDir = os.path.abspath( topDir ) |
33 | 33 |
34 | 34 |
35 # TODO: this might be useful for other scripts; can we make it available? | 35 # TODO: this might be useful for other scripts; can we make it available? |
36 manuals = map(lambda x: os.path.splitext(x)[0], | 36 manuals = [os.path.splitext(x)[0] for x in list(map(os.path.basename, |
37 map(os.path.basename, | 37 glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))] |
38 glob.glob(os.path.join(topDir,'Documentation', '*.te??')))) | |
39 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals) | 38 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals) |
40 manuals.append('internals') | 39 manuals.append('internals') |
41 | 40 |
42 | 41 |
43 version_file_path = os.path.join(topDir, "VERSION") | 42 version_file_path = os.path.join(topDir, "VERSION") |
44 | 43 |
45 version_contents = open(version_file_path).readlines() | 44 version_contents = open(version_file_path).readlines() |
46 major = 0 | 45 major = 0 |
47 minor = 0 | 46 minor = 0 |
48 patch = 0 | 47 patch = 0 |
49 for line in version_contents: | 48 for line in version_contents: |
50 if (line.startswith('MAJOR_VERSION')): | 49 if (line.startswith('MAJOR_VERSION')): |
51 major = line[14:-1] | 50 major = line[14:-1] |
52 if (line.startswith('MINOR_VERSION')): | 51 if (line.startswith('MINOR_VERSION')): |
53 minor = line[14:-1] | 52 minor = line[14:-1] |
54 if (line.startswith('PATCH_LEVEL')): | 53 if (line.startswith('PATCH_LEVEL')): |
55 patch = line[12:-1] | 54 patch = line[12:-1] |
56 if (line.startswith('VERSION_STABLE')): | 55 if (line.startswith('VERSION_STABLE')): |
57 VERSION_STABLE = line[15:-1] | 56 VERSION_STABLE = line[15:-1] |
58 if (line.startswith('VERSION_DEVEL')): | 57 if (line.startswith('VERSION_DEVEL')): |
59 VERSION_DEVEL = line[14:-1] | 58 VERSION_DEVEL = line[14:-1] |
60 | 59 |
61 VERSION = str(major)+'.'+str(minor)+'.'+str(patch) | 60 VERSION = str(major)+'.'+str(minor)+'.'+str(patch) |
62 | 61 |
63 def make_macro(name, string): | 62 def make_macro(name, string): |
64 print "@macro", name | 63 print("@macro", name) |
65 print string | 64 print(string) |
66 print "@end macro" | 65 print("@end macro") |
67 print "" | 66 print("") |
68 | 67 |
69 print "@c This file was autogenerated" | 68 print("@c This file was autogenerated") |
70 print "@c from: VERSION" | 69 print("@c from: VERSION") |
71 print "@c by: %s" % sys.argv[0] | 70 print("@c by: %s" % sys.argv[0]) |
72 print "" | 71 print("") |
73 print "@c ************************ Version numbers ************" | 72 print("@c ************************ Version numbers ************") |
74 print "" | 73 print("") |
75 | 74 |
76 make_macro("version", VERSION) | 75 make_macro("version", VERSION) |
77 make_macro("versionStable", VERSION_STABLE) | 76 make_macro("versionStable", VERSION_STABLE) |
78 make_macro("versionDevel", VERSION_DEVEL) | 77 make_macro("versionDevel", VERSION_DEVEL) |
79 | 78 |
80 print "@c *****************************************************" | 79 print("@c *****************************************************") |
OLD | NEW |