]> git.donarmstrong.com Git - lilypond.git/blob - scripts/build/create-version-itexi.py
Merge branch 'lilypond/translation' of ssh://git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / scripts / build / create-version-itexi.py
1 #!@PYTHON@
2 # create-version-itexi.py
3
4 import sys
5 import os
6 import glob
7
8 ## these links are relative from /~graham/web/
9 #WEB_DOCLINK_STABLE = "../../doc/v2.12/Documentation/user/lilypond-"
10 #WEB_DOCLINK_DEVEL = "../../doc/v2.13/Documentation/"
11
12 # these links are relative from the v2.13 docs
13 WEB_DOCLINK_STABLE = "../../../v2.12/Documentation/user/lilypond-"
14 WEB_DOCLINK_DEVEL = "../../../v2.13/Documentation/"
15
16
17
18 VERSION_STABLE = ""
19 VERSION_DEVEL = ""
20
21 myDir = os.path.dirname(sys.argv[0])
22 # use two abspaths to work around some windows python bug
23 topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
24 topDir = os.path.abspath( topDir )
25
26 # TODO: this might be useful for other scripts; can we make it available?
27 manuals = map(lambda x: os.path.splitext(x)[0],
28               map(os.path.basename,
29                   glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
30 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
31 manuals.append('internals')
32
33
34 version_file_path = os.path.join(topDir, "VERSION")
35
36 version_contents = open(version_file_path).readlines()
37 for line in version_contents:
38         if (line[0:14] == 'VERSION_STABLE'):
39                 VERSION_STABLE = line[15:-1]
40         if (line[0:13] == 'VERSION_DEVEL'):
41                 VERSION_DEVEL = line[14:-1]
42
43 def make_macro(name, string):
44         print "@macro", name
45         print string
46         print "@end macro"
47         print ""
48
49 def make_download(name, osA, osB, version, revision, text):
50         string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
51         string += osA + "lilypond-"
52         string += version + "-" + revision
53         string += "." + osB + ",\n"
54         string += text
55         string += ": LilyPond "
56         string += version + "-" + revision
57         string += "}"
58         make_macro(name, string)
59
60 def make_download_source(name, vstring, version):
61         string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
62         string += vstring + "/"
63         string += "lilypond-" + version + ".tar.gz"
64         string += ", "
65         string += "lilypond-" + version + ".tar.gz"
66         string += "}"
67         make_macro(name, string)
68
69 def make_all_downloads(macroName, version):
70         make_download("download"+macroName+"LinuxNormal", "linux-x86/",
71                 "linux-x86.sh", version, "1", "Linux x86")
72         make_download("download"+macroName+"LinuxBig", "linux-64/",
73                 "linux-64.sh", version, "1", "Linux 64")
74         make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
75                 "linux-ppc.sh", version, "1", "Linux PPC")
76         
77         make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
78                 "freebsd-x86.sh", version, "1", "FreeBSD i386")
79         make_download("download"+macroName+"FreeBSDBig", "freebsd-x86/",
80                 "freebsd-64.sh", version, "1", "FreeBSD amd64")
81         
82         make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
83                 "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
84         make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
85                 "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
86
87         make_download("download"+macroName+"Windows", "mingw/",
88                 "mingw.exe", version, "1", "Windows")
89
90 def make_ver_link(macroname, version, url, linktext):
91         string = "@uref{"
92         # TODO: generalize this
93         if (version[:4] == '2.13'):
94                 string += WEB_DOCLINK_DEVEL
95         if (version[:4] == '2.12'):
96                 string += WEB_DOCLINK_STABLE
97         string += url
98         string += ","
99         string += linktext
100         string += "}"
101         make_macro(macroname, string)
102
103 def make_manual_links(name, version):
104         for m in manuals:
105                 # FIXME: this is disgusting
106                 manual = m
107                 mshort = 'glossary' if m=='music-glossary' else m
108                 make_ver_link("manual"+name+mshort.capitalize()+'Pdf',
109                           version,
110                           manual + '.pdf',
111                           manual.capitalize() + '.pdf')
112                 make_ver_link("manual"+name+mshort.capitalize()+'Split',
113                           version,
114                           manual+'/index.html',
115                           manual.capitalize() + ' (split HTML)')
116                 make_ver_link("manual"+name+mshort.capitalize()+'Big',
117                           version,
118                           manual+'-big-page.html',
119                           manual.capitalize() + ' (big HTML)')
120
121
122 print "@c ************************ Version numbers ************"
123 make_macro("versionStable", VERSION_STABLE)
124 make_macro("versionDevel", VERSION_DEVEL)
125
126 print "@c ************************ Download binaries ************"
127 make_all_downloads("Stable", VERSION_STABLE)
128 make_all_downloads("Devel", VERSION_DEVEL)
129
130 print "@c ************************ Download source ************"
131 # FIXME: icky hard-coding!  -gp
132 make_download_source("downloadStableSource", "v2.12", VERSION_STABLE)
133 make_download_source("downloadDevelSource", "v2.13", VERSION_DEVEL)
134
135 print "@c ************************ Manual links ************"
136 make_manual_links("Stable", VERSION_STABLE)
137 make_manual_links("Devel", VERSION_DEVEL)
138
139
140