2 # -*- coding: utf-8 -*-
3 # create-version-itexi.py
5 """ when being called on lilypond.org, pass it the location of the
6 top source dir on the command-line. """
12 # these links are relative from /website/ on lilypond.org
15 ### translation data -- shouldn't be here; see issue
16 ### http://code.google.com/p/lilypond/issues/detail?id=1050
18 # don't add your language to this list unless you have all the
24 'Source': 'Código fuente',
26 'Learning': 'Aprendizaj',
27 'Music glossary': 'Glosario',
36 'Contributor': 'Guía del colaborador',
39 ' (split HTML)': ' (muchas páginas HTML)',
40 ' (big HTML)': ' (como una sola página HTML enorme)',
42 'Regression tests for ': 'aa ',
43 'PDF of regtests for ': 'bb ',
44 'MusicXML Regression tests for ': 'cc ',
45 'PDF of MusicXML regtests for ': 'dd ',
47 'Doc tarball for ': 'ee ',
48 ' (did not exist in 2.12)': ' (existes la nottes e 2.12)',
51 'Learning': 'Apprener?',
52 'Music glossary': 'Lizes ici pour les motes?',
67 myDir = os.path.dirname(sys.argv[0])
68 # use two abspaths to work around some windows python bug
69 topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
70 topDir = os.path.abspath( topDir )
73 # TODO: this might be useful for other scripts; can we make it available?
74 manuals = map(lambda x: os.path.splitext(x)[0],
76 glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
77 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
78 manuals.append('internals')
81 version_file_path = os.path.join(topDir, "VERSION")
83 version_contents = open(version_file_path).readlines()
87 for line in version_contents:
88 if (line.startswith('MAJOR_VERSION')):
90 if (line.startswith('MINOR_VERSION')):
92 if (line.startswith('PATCH_LEVEL')):
94 if (line.startswith('VERSION_STABLE')):
95 VERSION_STABLE = line[15:-1]
96 if (line.startswith('VERSION_DEVEL')):
97 VERSION_DEVEL = line[14:-1]
99 VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
101 def getTrans(text, lang):
103 text = translations[lang][text]
106 def macroLang(name, lang):
108 return name + '-' + lang
111 def make_macro(name, string):
117 def make_download(name, osA, osB, version, revision, text):
118 string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
119 string += osA + "lilypond-"
120 string += version + "-" + revision
121 string += "." + osB + ",\n"
123 string += ": LilyPond "
124 string += version + "-" + revision
126 make_macro(name, string)
128 def make_download_source(name, vstring, version, lang):
129 string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
130 string += vstring + "/"
131 string += "lilypond-" + version + ".tar.gz"
133 string += getTrans("Source", lang)
134 string += ": lilypond-" + version + ".tar.gz"
136 make_macro(macroLang(name,lang), string)
138 def make_all_downloads(macroName, version):
139 make_download("download"+macroName+"LinuxNormal", "linux-x86/",
140 "linux-x86.sh", version, "1", "Linux x86")
141 make_download("download"+macroName+"LinuxBig", "linux-64/",
142 "linux-64.sh", version, "1", "Linux 64")
143 make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
144 "linux-ppc.sh", version, "1", "Linux PPC")
146 make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
147 "freebsd-x86.sh", version, "1", "FreeBSD i386")
148 make_download("download"+macroName+"FreeBSDBig", "freebsd-64/",
149 "freebsd-64.sh", version, "1", "FreeBSD amd64")
151 make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
152 "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
153 make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
154 "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
156 make_download("download"+macroName+"Windows", "mingw/",
157 "mingw.exe", version, "1", "Windows")
159 def make_ver_link(macroname, url, linktext):
165 make_macro(macroname, string)
167 # TODO: this kind of thing should really be in a central place for
168 # lilypond python build scripts
169 def translateNameToUrl(manual, version):
170 ver_split = version.split('.')
171 ver_minor = ver_split[0] + '.' + ver_split[1]
172 url = depth + "doc/v" + ver_minor + "/Documentation/"
174 if (ver_minor == '2.13'):
176 if (ver_minor == '2.12'):
177 if (manual=='learning'):
178 return url+'user/lilypond-learning'
179 elif (manual=='internals'):
180 return url+'user/lilypond-internals'
181 elif (manual=='notation'):
182 return url+'user/lilypond'
183 elif (manual=='usage'):
184 return url+'user/lilypond-program'
185 elif (manual=='snippets'):
186 return url+'../input/lsr/lilypond-snippets'
187 elif (manual=='changes'):
188 return url+'topdocs/NEWS.html'
189 elif (manual=='music-glossary'):
190 return url+'user/music-glossary'
191 elif (manual=='essay'):
192 return url+'user/lilypond-learning/Background.html'
193 elif (manual=='extending'):
194 return url+'user/lilypond/Interfaces-for-programmers.html'
199 def make_manual_links(name, version, lang):
202 # TODO: this is a stupid way of doing it
203 if (m=='music-glossary'):
206 mshort = m.capitalize()
207 if (manual=='music-glossary'):
208 manual = 'Music glossary'
209 url = translateNameToUrl(m, version)
212 # can't have a comma here due to texinfo
213 make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang),
214 "http://lilypond.org",
215 mshort+getTrans(" (did not exist in 2.12)",lang))
216 make_ver_link(macroLang("manual"+name+mshort+'Split',lang),
217 "http://lilypond.org",
218 mshort+getTrans(" (did not exist in 2.12)",lang))
219 make_ver_link(macroLang("manual"+name+mshort+'Big',lang),
220 "http://lilypond.org",
221 mshort+getTrans(" (did not exist in 2.12)",lang))
222 make_ver_link(macroLang("manual"+name+mshort+'SplitNoName',lang),
223 "http://lilypond.org",
224 mshort+getTrans(" (did not exist in 2.12)",lang))
226 make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang),
228 getTrans(manual.capitalize(),lang) + '.pdf')
229 make_ver_link(macroLang("manual"+name+mshort+'Split',lang),
231 getTrans(manual.capitalize(),lang) +
232 getTrans(' (split HTML)',lang))
233 make_ver_link(macroLang("manual"+name+mshort+'Big',lang),
234 url + '-big-page.html',
235 getTrans(manual.capitalize(),lang) +
236 getTrans(' (big HTML)',lang))
237 # this is stupid and I shouldn't have bothered trying
238 # to support the 2.12 docs and it will be deleted once
239 # 2.14 is out and the website won't be visible to users
240 # until 2.14 is out. -gp
241 if (url.endswith('.html')):
244 newurl = url + '/index.html'
245 make_ver_link(macroLang("manual"+name+mshort+'SplitNoName',lang),
249 def make_regtest_links(name, version, lang):
250 ver_split = version.split('.')
251 ver_minor = ver_split[0] + '.' + ver_split[1]
252 url = depth + "doc/v" + ver_minor + "/input/regression/"
254 make_ver_link(macroLang("regtest"+name, lang),
255 url+"collated-files.html",
256 getTrans("Regression tests for ", lang)+version)
257 make_ver_link(macroLang("regtest"+name+"Pdf", lang),
258 url+"collated-files.pdf",
259 getTrans("PDF of regtests for ", lang)+version)
260 make_ver_link(macroLang("regtest"+name+"Xml", lang),
261 url+"musicxml/collated-files.html",
262 getTrans("MusicXML Regression tests for ", lang)+version)
263 make_ver_link(macroLang("regtest"+name+"XmlPdf", lang),
264 url+"musicxml/collated-files.html",
265 getTrans("PDF of MusicXML regtests for ", lang)+version)
267 def make_doctarball_links(name, version, lang):
268 url = depth + "download/binaries/documentation/lilypond-"
269 # ugly FIXME, but proper build number support isn't Critical.
270 url += version + "-1"
271 url += ".documentation.tar.bz2"
272 make_ver_link(macroLang("doctarball"+name, lang),
273 url, getTrans("Doc tarball for ", lang)+version)
275 print "@c ************************ Download binaries ************"
276 make_all_downloads("Stable", VERSION_STABLE)
277 make_all_downloads("Devel", VERSION_DEVEL)
279 print "@c ************************ Download source ************"
280 # FIXME: icky hard-coding! -gp
282 print "@c *********", lang, "***"
283 make_download_source("downloadStableSource","v2.12",VERSION_STABLE,lang)
284 make_download_source("downloadDevelSource","v2.13",VERSION_DEVEL,lang)
286 print "@c ************************ Manual links ************"
288 print "@c *********", lang, "***"
289 make_manual_links("Stable", VERSION_STABLE,lang)
290 make_manual_links("Devel", VERSION_DEVEL,lang)
292 make_doctarball_links("Stable", VERSION_STABLE,lang)
293 make_doctarball_links("Devel", VERSION_DEVEL,lang)
295 print "@c ************************ Regtest links ************"
297 print "@c *********", lang, "***"
298 make_regtest_links("Stable", VERSION_STABLE,lang)
299 make_regtest_links("Devel", VERSION_DEVEL,lang)