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
20 # Hmm, is this a feature -- why not keep original english as a fallback?
21 langs = ['', 'es', 'fr', 'nl']
23 # Get/update node translations
25 for i in es fr nl de hu ja it; do
27 (echo '--' ; grep -nH -B1 translationof Documentation/$i/web/*) \
28 | pytt '^--\n.*@(?:unnum|sub)[^ ]* (.*)\n.*@translationof (.*)\n' "'\2': '\1',\n" \
29 | grep -E 'Source|Learning|Glossary|Essay|Notation|Usage|Snippets|Web|Changes|Extending|Internals|Contributor'
36 'Source': 'Código fuente',
38 'Learning': 'Aprendizaje',
39 'Music glossary': 'Glosario',
41 'Notation': 'Notación',
42 'Usage': 'Utilización',
43 'Snippets': 'Fragmentos',
46 'Extending': 'Extensión',
47 'Internals': 'Funcionamiento interno',
48 'Contributor': 'Guía del colaborador',
51 ' (split HTML)': ' (HTML seccionado)',
52 ' (big HTML)': ' (HTML monolítico)',
54 'Regression tests for ': 'Pruebas de regresión para ',
55 'PDF of regtests for ': 'Pruebas en PDF para ',
56 'MusicXML Regression tests for ': 'Pruebas de regresión de MusicXML para ',
57 'PDF of MusicXML regtests for ': 'Pruebas de MusicXML en PDF para ',
59 'Doc tarball for ': 'Tarball de la documentación para ',
60 ' (did not exist in 2.12)': ' (no existía en la versión 2.12)',
65 'Learning': 'Initiation',
66 'Music glossary': 'Glossaire',
68 'Notation': 'Notation',
69 'Usage': 'Utilisation',
70 'Snippets': 'Morceaux choisis',
72 'Changes': 'Nouveautés',
73 'Extending': 'Extension',
74 'Internals': 'Propriétés internes',
75 'Contributor': 'Guide du contributeur',
78 ' (split HTML)': ' (HTML multipages)',
79 ' (big HTML)': ' (HTML en page unique)',
81 'Regression tests for ': 'Tests de régression pour ',
82 'PDF of regtests for ': 'PDF des tests de régression pour ',
83 'MusicXML Regression tests for ': 'Tests de régression de MusicXML pour ',
84 'PDF of MusicXML regtests for ': 'PDF des tests de régression de MusicXML pour ',
86 'Doc tarball for ': 'Archive de la documentation pour ',
87 ' (did not exist in 2.12)': ' (non disponible pour la version 2.12)',
92 'Learning': 'Beginnen',
93 'Music glossary': 'Terminologie',
95 'Notation': 'Notatie',
97 'Snippets': 'Snippers',
99 'Changes': 'Veranderingen',
100 'Extending': 'Uitbreidingen',
101 'Internals': 'Internals',
102 'Contributor': 'Contributor',
105 ' (split HTML)': ' (opgesplitste HTML)',
106 ' (big HTML)': ' (grote pagina HTML)',
108 'Regression tests for ': 'Regressietesten voor ',
109 'PDF of regtests for ': 'PDF van regressietesten voor ',
110 'MusicXML Regression tests for ': 'MusicXML regressietesten voor ',
111 'PDF of MusicXML regtests for ': 'MusicXML regressietesten voor ',
113 'Doc tarball for ': 'Tarball met documentation voor ',
114 ' (did not exist in 2.12)': ' (bestond nog niet in 2.12)',
118 'Learning': 'Einführung',
119 'Music glossary': 'Glossar',
121 'Notation': 'Notation',
122 'Usage': 'Benutzung',
123 'Snippets': 'Schnipsel',
125 'Changes': 'Änderungen',
126 'Internals': 'Interna',
132 'Learning': 'Tankönyv',
133 'Music glossary': 'Fogalomtár',
135 'Notation': 'Kottaírás',
136 'Usage': 'Használat',
137 'Snippets': 'Kódrészletek',
139 'Changes': 'Változások',
140 'Internals': 'Belső működés',
147 'Music glossary': '用語集',
151 'Snippets': 'コード断片集',
154 'Internals': '内部リファレンス',
172 myDir = os.path.dirname(sys.argv[0])
173 # use two abspaths to work around some windows python bug
174 topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
175 topDir = os.path.abspath( topDir )
178 # TODO: this might be useful for other scripts; can we make it available?
179 manuals = map(lambda x: os.path.splitext(x)[0],
180 map(os.path.basename,
181 glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
182 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
183 manuals.append('internals')
186 version_file_path = os.path.join(topDir, "VERSION")
188 version_contents = open(version_file_path).readlines()
192 for line in version_contents:
193 if (line.startswith('MAJOR_VERSION')):
195 if (line.startswith('MINOR_VERSION')):
197 if (line.startswith('PATCH_LEVEL')):
199 if (line.startswith('VERSION_STABLE')):
200 VERSION_STABLE = line[15:-1]
201 if (line.startswith('VERSION_DEVEL')):
202 VERSION_DEVEL = line[14:-1]
204 VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
206 def getTrans(text, lang):
208 text = translations[lang][text]
211 def macroLang(name, lang):
213 return name + '-' + lang
216 def make_macro(name, string):
222 def make_download(name, osA, osB, version, revision, text):
223 string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
224 string += osA + "lilypond-"
225 string += version + "-" + revision
226 string += "." + osB + ",\n"
228 string += ": LilyPond "
229 string += version + "-" + revision
231 make_macro(name, string)
233 def make_download_source(name, vstring, version, lang):
234 string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
235 string += vstring + "/"
236 string += "lilypond-" + version + ".tar.gz"
238 string += getTrans("Source", lang)
239 string += ": lilypond-" + version + ".tar.gz"
241 make_macro(macroLang(name,lang), string)
243 def make_all_downloads(macroName, version):
244 make_download("download"+macroName+"LinuxNormal", "linux-x86/",
245 "linux-x86.sh", version, "1", "Linux x86")
246 make_download("download"+macroName+"LinuxBig", "linux-64/",
247 "linux-64.sh", version, "1", "Linux 64")
248 make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
249 "linux-ppc.sh", version, "1", "Linux PPC")
251 make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
252 "freebsd-x86.sh", version, "1", "FreeBSD i386")
253 make_download("download"+macroName+"FreeBSDBig", "freebsd-64/",
254 "freebsd-64.sh", version, "1", "FreeBSD amd64")
256 make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
257 "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
258 make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
259 "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
261 make_download("download"+macroName+"Windows", "mingw/",
262 "mingw.exe", version, "1", "Windows")
264 def make_ver_link(macroname, url, linktext):
270 make_macro(macroname, string)
272 # TODO: this kind of thing should really be in a central place for
273 # lilypond python build scripts
274 def translateNameToUrl(manual, version):
275 ver_split = version.split('.')
276 ver_minor = ver_split[0] + '.' + ver_split[1]
277 url = depth + "doc/v" + ver_minor + "/Documentation/"
279 if (ver_minor == '2.13'):
281 if (ver_minor == '2.12'):
282 if (manual=='learning'):
283 return url+'user/lilypond-learning'
284 elif (manual=='internals'):
285 return url+'user/lilypond-internals'
286 elif (manual=='notation'):
287 return url+'user/lilypond'
288 elif (manual=='usage'):
289 return url+'user/lilypond-program'
290 elif (manual=='snippets'):
291 return url+'../input/lsr/lilypond-snippets'
292 elif (manual=='changes'):
293 return url+'topdocs/NEWS.html'
294 elif (manual=='music-glossary'):
295 return url+'user/music-glossary'
296 elif (manual=='essay'):
297 return url+'user/lilypond-learning/Background.html'
298 elif (manual=='extending'):
299 return url+'user/lilypond/Interfaces-for-programmers.html'
304 def make_manual_links(name, version, lang):
305 """Here is where all the macros manualStableLearningSplit,
306 manualStableLearningBig, manualStableLearningSplitNoName, etc. are
307 created on the fly. Hopefully this documentation string will help
308 others a bit while grepping for those.
312 # TODO: this is a stupid way of doing it
313 if (m=='music-glossary'):
316 mshort = m.capitalize()
317 if (manual=='music-glossary'):
318 manual = 'Music glossary'
319 url = translateNameToUrl(m, version)
322 # can't have a comma here due to texinfo
323 make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang),
324 "http://lilypond.org",
325 mshort+getTrans(" (did not exist in 2.12)",lang))
326 make_ver_link(macroLang("manual"+name+mshort+'Split',lang),
327 "http://lilypond.org",
328 mshort+getTrans(" (did not exist in 2.12)",lang))
329 make_ver_link(macroLang("manual"+name+mshort+'Big',lang),
330 "http://lilypond.org",
331 mshort+getTrans(" (did not exist in 2.12)",lang))
332 make_ver_link(macroLang("manual"+name+mshort+'SplitNoName',lang),
333 "http://lilypond.org",
334 mshort+getTrans(" (did not exist in 2.12)",lang))
336 make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang),
338 getTrans(manual.capitalize(),lang) + '.pdf')
339 make_ver_link(macroLang("manual"+name+mshort+'Split',lang),
341 getTrans(manual.capitalize(),lang) +
342 getTrans(' (split HTML)',lang))
343 make_ver_link(macroLang("manual"+name+mshort+'Big',lang),
344 url + '-big-page.html',
345 getTrans(manual.capitalize(),lang) +
346 getTrans(' (big HTML)',lang))
347 # this is stupid and I shouldn't have bothered trying
348 # to support the 2.12 docs and it will be deleted once
349 # 2.14 is out and the website won't be visible to users
350 # until 2.14 is out. -gp
351 if (url.endswith('.html')):
354 newurl = url + '/index.html'
355 make_ver_link(macroLang("manual"+name+mshort+'SplitNoName',lang),
357 getTrans(manual.capitalize(),lang))
359 def make_regtest_links(name, version, lang):
360 ver_split = version.split('.')
361 ver_minor = ver_split[0] + '.' + ver_split[1]
362 url = depth + "doc/v" + ver_minor + "/input/regression/"
364 make_ver_link(macroLang("regtest"+name, lang),
365 url+"collated-files.html",
366 getTrans("Regression tests for ", lang)+version)
367 make_ver_link(macroLang("regtest"+name+"Pdf", lang),
368 url+"collated-files.pdf",
369 getTrans("PDF of regtests for ", lang)+version)
370 make_ver_link(macroLang("regtest"+name+"Xml", lang),
371 url+"musicxml/collated-files.html",
372 getTrans("MusicXML Regression tests for ", lang)+version)
373 make_ver_link(macroLang("regtest"+name+"XmlPdf", lang),
374 url+"musicxml/collated-files.html",
375 getTrans("PDF of MusicXML regtests for ", lang)+version)
377 def make_doctarball_links(name, version, lang):
378 url = depth + "download/binaries/documentation/lilypond-"
379 # ugly FIXME, but proper build number support isn't Critical.
380 url += version + "-1"
381 url += ".documentation.tar.bz2"
382 make_ver_link(macroLang("doctarball"+name, lang),
383 url, getTrans("Doc tarball for ", lang)+version)
385 print "@c ************************ Download binaries ************"
386 make_all_downloads("Stable", VERSION_STABLE)
387 make_all_downloads("Devel", VERSION_DEVEL)
389 print "@c ************************ Download source ************"
390 # FIXME: icky hard-coding! -gp
392 print "@c *********", lang, "***"
393 make_download_source("downloadStableSource","v2.12",VERSION_STABLE,lang)
394 make_download_source("downloadDevelSource","v2.13",VERSION_DEVEL,lang)
396 print "@c ************************ Manual links ************"
398 print "@c *********", lang, "***"
399 make_manual_links("Stable", VERSION_STABLE,lang)
400 make_manual_links("Devel", VERSION_DEVEL,lang)
402 make_doctarball_links("Stable", VERSION_STABLE,lang)
403 make_doctarball_links("Devel", VERSION_DEVEL,lang)
405 print "@c ************************ Regtest links ************"
407 print "@c *********", lang, "***"
408 make_regtest_links("Stable", VERSION_STABLE,lang)
409 make_regtest_links("Devel", VERSION_DEVEL,lang)