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
22 # FIXME: `grep -nH -B1 translationof Documentation/<lang>/web/*'
23 # gives us the correct node names.
26 'Source': 'Código fuente',
28 'Learning': 'Aprendizaje',
29 'Music glossary': 'Glosario',
31 'Notation': 'Notación',
32 'Usage': 'Utilización',
33 'Snippets': 'Fragmentos',
36 'Extending': 'Extensión',
37 'Internals': 'Funcionamiento interno',
38 'Contributor': 'Guía del colaborador',
41 ' (split HTML)': ' (HTML seccionado)',
42 ' (big HTML)': ' (HTML monolítico)',
44 'Regression tests for ': 'Pruebas de regresión para ',
45 'PDF of regtests for ': 'Pruebas en PDF para ',
46 'MusicXML Regression tests for ': 'Pruebas de regresión de MusicXML para ',
47 'PDF of MusicXML regtests for ': 'Pruebas de MusicXML en PDF para ',
49 'Doc tarball for ': 'Tarball de la documentación para ',
50 ' (did not exist in 2.12)': ' (no existía en la versión 2.12)',
53 'Learning': 'Apprener?',
54 'Music glossary': 'Lizes ici pour les motes?',
59 'Learning': 'Beginnen',
60 'Music glossary': 'Terminologie',
62 'Notation': 'Notatie',
64 'Snippets': 'Snippers',
66 'Changes': 'Veranderingen',
67 'Extending': 'Uitbreidingen',
68 'Internals': 'Internals',
69 'Contributor': 'Contributor',
72 ' (split HTML)': ' (opgesplitste HTML)',
73 ' (big HTML)': ' (grote pagina HTML)',
75 'Regression tests for ': 'Regressietesten voor ',
76 'PDF of regtests for ': 'PDF van regressietesten voor ',
77 'MusicXML Regression tests for ': 'MusicXML regressietesten voor ',
78 'PDF of MusicXML regtests for ': 'MusicXML regressietesten voor ',
80 'Doc tarball for ': 'Tarball met documentation voor ',
81 ' (did not exist in 2.12)': ' (bestond nog niet in 2.12)',
96 myDir = os.path.dirname(sys.argv[0])
97 # use two abspaths to work around some windows python bug
98 topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
99 topDir = os.path.abspath( topDir )
102 # TODO: this might be useful for other scripts; can we make it available?
103 manuals = map(lambda x: os.path.splitext(x)[0],
104 map(os.path.basename,
105 glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
106 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
107 manuals.append('internals')
110 version_file_path = os.path.join(topDir, "VERSION")
112 version_contents = open(version_file_path).readlines()
116 for line in version_contents:
117 if (line.startswith('MAJOR_VERSION')):
119 if (line.startswith('MINOR_VERSION')):
121 if (line.startswith('PATCH_LEVEL')):
123 if (line.startswith('VERSION_STABLE')):
124 VERSION_STABLE = line[15:-1]
125 if (line.startswith('VERSION_DEVEL')):
126 VERSION_DEVEL = line[14:-1]
128 VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
130 def getTrans(text, lang):
132 text = translations[lang][text]
135 def macroLang(name, lang):
137 return name + '-' + lang
140 def make_macro(name, string):
146 def make_download(name, osA, osB, version, revision, text):
147 string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
148 string += osA + "lilypond-"
149 string += version + "-" + revision
150 string += "." + osB + ",\n"
152 string += ": LilyPond "
153 string += version + "-" + revision
155 make_macro(name, string)
157 def make_download_source(name, vstring, version, lang):
158 string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
159 string += vstring + "/"
160 string += "lilypond-" + version + ".tar.gz"
162 string += getTrans("Source", lang)
163 string += ": lilypond-" + version + ".tar.gz"
165 make_macro(macroLang(name,lang), string)
167 def make_all_downloads(macroName, version):
168 make_download("download"+macroName+"LinuxNormal", "linux-x86/",
169 "linux-x86.sh", version, "1", "Linux x86")
170 make_download("download"+macroName+"LinuxBig", "linux-64/",
171 "linux-64.sh", version, "1", "Linux 64")
172 make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
173 "linux-ppc.sh", version, "1", "Linux PPC")
175 make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
176 "freebsd-x86.sh", version, "1", "FreeBSD i386")
177 make_download("download"+macroName+"FreeBSDBig", "freebsd-64/",
178 "freebsd-64.sh", version, "1", "FreeBSD amd64")
180 make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
181 "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
182 make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
183 "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
185 make_download("download"+macroName+"Windows", "mingw/",
186 "mingw.exe", version, "1", "Windows")
188 def make_ver_link(macroname, url, linktext):
194 make_macro(macroname, string)
196 # TODO: this kind of thing should really be in a central place for
197 # lilypond python build scripts
198 def translateNameToUrl(manual, version):
199 ver_split = version.split('.')
200 ver_minor = ver_split[0] + '.' + ver_split[1]
201 url = depth + "doc/v" + ver_minor + "/Documentation/"
203 if (ver_minor == '2.13'):
205 if (ver_minor == '2.12'):
206 if (manual=='learning'):
207 return url+'user/lilypond-learning'
208 elif (manual=='internals'):
209 return url+'user/lilypond-internals'
210 elif (manual=='notation'):
211 return url+'user/lilypond'
212 elif (manual=='usage'):
213 return url+'user/lilypond-program'
214 elif (manual=='snippets'):
215 return url+'../input/lsr/lilypond-snippets'
216 elif (manual=='changes'):
217 return url+'topdocs/NEWS.html'
218 elif (manual=='music-glossary'):
219 return url+'user/music-glossary'
220 elif (manual=='essay'):
221 return url+'user/lilypond-learning/Background.html'
222 elif (manual=='extending'):
223 return url+'user/lilypond/Interfaces-for-programmers.html'
228 def make_manual_links(name, version, lang):
231 # TODO: this is a stupid way of doing it
232 if (m=='music-glossary'):
235 mshort = m.capitalize()
236 if (manual=='music-glossary'):
237 manual = 'Music glossary'
238 url = translateNameToUrl(m, version)
241 # can't have a comma here due to texinfo
242 make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang),
243 "http://lilypond.org",
244 mshort+getTrans(" (did not exist in 2.12)",lang))
245 make_ver_link(macroLang("manual"+name+mshort+'Split',lang),
246 "http://lilypond.org",
247 mshort+getTrans(" (did not exist in 2.12)",lang))
248 make_ver_link(macroLang("manual"+name+mshort+'Big',lang),
249 "http://lilypond.org",
250 mshort+getTrans(" (did not exist in 2.12)",lang))
251 make_ver_link(macroLang("manual"+name+mshort+'SplitNoName',lang),
252 "http://lilypond.org",
253 mshort+getTrans(" (did not exist in 2.12)",lang))
255 make_ver_link(macroLang("manual"+name+mshort+'Pdf',lang),
257 getTrans(manual.capitalize(),lang) + '.pdf')
258 make_ver_link(macroLang("manual"+name+mshort+'Split',lang),
260 getTrans(manual.capitalize(),lang) +
261 getTrans(' (split HTML)',lang))
262 make_ver_link(macroLang("manual"+name+mshort+'Big',lang),
263 url + '-big-page.html',
264 getTrans(manual.capitalize(),lang) +
265 getTrans(' (big HTML)',lang))
266 # this is stupid and I shouldn't have bothered trying
267 # to support the 2.12 docs and it will be deleted once
268 # 2.14 is out and the website won't be visible to users
269 # until 2.14 is out. -gp
270 if (url.endswith('.html')):
273 newurl = url + '/index.html'
274 make_ver_link(macroLang("manual"+name+mshort+'SplitNoName',lang),
278 def make_regtest_links(name, version, lang):
279 ver_split = version.split('.')
280 ver_minor = ver_split[0] + '.' + ver_split[1]
281 url = depth + "doc/v" + ver_minor + "/input/regression/"
283 make_ver_link(macroLang("regtest"+name, lang),
284 url+"collated-files.html",
285 getTrans("Regression tests for ", lang)+version)
286 make_ver_link(macroLang("regtest"+name+"Pdf", lang),
287 url+"collated-files.pdf",
288 getTrans("PDF of regtests for ", lang)+version)
289 make_ver_link(macroLang("regtest"+name+"Xml", lang),
290 url+"musicxml/collated-files.html",
291 getTrans("MusicXML Regression tests for ", lang)+version)
292 make_ver_link(macroLang("regtest"+name+"XmlPdf", lang),
293 url+"musicxml/collated-files.html",
294 getTrans("PDF of MusicXML regtests for ", lang)+version)
296 def make_doctarball_links(name, version, lang):
297 url = depth + "download/binaries/documentation/lilypond-"
298 # ugly FIXME, but proper build number support isn't Critical.
299 url += version + "-1"
300 url += ".documentation.tar.bz2"
301 make_ver_link(macroLang("doctarball"+name, lang),
302 url, getTrans("Doc tarball for ", lang)+version)
304 print "@c ************************ Download binaries ************"
305 make_all_downloads("Stable", VERSION_STABLE)
306 make_all_downloads("Devel", VERSION_DEVEL)
308 print "@c ************************ Download source ************"
309 # FIXME: icky hard-coding! -gp
311 print "@c *********", lang, "***"
312 make_download_source("downloadStableSource","v2.12",VERSION_STABLE,lang)
313 make_download_source("downloadDevelSource","v2.13",VERSION_DEVEL,lang)
315 print "@c ************************ Manual links ************"
317 print "@c *********", lang, "***"
318 make_manual_links("Stable", VERSION_STABLE,lang)
319 make_manual_links("Devel", VERSION_DEVEL,lang)
321 make_doctarball_links("Stable", VERSION_STABLE,lang)
322 make_doctarball_links("Devel", VERSION_DEVEL,lang)
324 print "@c ************************ Regtest links ************"
326 print "@c *********", lang, "***"
327 make_regtest_links("Stable", VERSION_STABLE,lang)
328 make_regtest_links("Devel", VERSION_DEVEL,lang)