2 # create-version-itexi.py
4 """ when being called on lilypond.org, pass it the location of the
5 top source dir on the command-line. """
11 # these links are relative from /website/
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 )
27 # TODO: this might be useful for other scripts; can we make it available?
28 manuals = map(lambda x: os.path.splitext(x)[0],
30 glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
31 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
32 manuals.append('internals')
35 version_file_path = os.path.join(topDir, "VERSION")
37 version_contents = open(version_file_path).readlines()
41 for line in version_contents:
42 if (line.startswith('MAJOR_VERSION')):
44 if (line.startswith('MINOR_VERSION')):
46 if (line.startswith('PATCH_LEVEL')):
48 if (line.startswith('VERSION_STABLE')):
49 VERSION_STABLE = line[15:-1]
50 if (line.startswith('VERSION_DEVEL')):
51 VERSION_DEVEL = line[14:-1]
53 VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
55 def make_macro(name, string):
61 def make_download(name, osA, osB, version, revision, text):
62 string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
63 string += osA + "lilypond-"
64 string += version + "-" + revision
65 string += "." + osB + ",\n"
67 string += ": LilyPond "
68 string += version + "-" + revision
70 make_macro(name, string)
72 def make_download_source(name, vstring, version):
73 string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
74 string += vstring + "/"
75 string += "lilypond-" + version + ".tar.gz"
77 string += "Source: lilypond-" + version + ".tar.gz"
79 make_macro(name, string)
81 def make_all_downloads(macroName, version):
82 make_download("download"+macroName+"LinuxNormal", "linux-x86/",
83 "linux-x86.sh", version, "1", "Linux x86")
84 make_download("download"+macroName+"LinuxBig", "linux-64/",
85 "linux-64.sh", version, "1", "Linux 64")
86 make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
87 "linux-ppc.sh", version, "1", "Linux PPC")
89 make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
90 "freebsd-x86.sh", version, "1", "FreeBSD i386")
91 make_download("download"+macroName+"FreeBSDBig", "freebsd-64/",
92 "freebsd-64.sh", version, "1", "FreeBSD amd64")
94 make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
95 "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
96 make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
97 "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
99 make_download("download"+macroName+"Windows", "mingw/",
100 "mingw.exe", version, "1", "Windows")
102 def make_ver_link(macroname, url, linktext):
108 make_macro(macroname, string)
110 # TODO: this kind of thing should really be in a central place for
111 # lilypond python build scripts
112 def translateNameToUrl(manual, version):
113 ver_split = version.split('.')
114 ver_minor = ver_split[0] + '.' + ver_split[1]
115 url = depth + "doc/v" + ver_minor + "/Documentation/"
117 if (ver_minor == '2.13'):
119 if (ver_minor == '2.12'):
120 if (manual=='learning'):
121 return url+'user/lilypond-learning'
122 elif (manual=='internals'):
123 return url+'user/lilypond-internals'
124 elif (manual=='notation'):
125 return url+'user/lilypond'
126 elif (manual=='usage'):
127 return url+'user/lilypond-program'
128 elif (manual=='snippets'):
129 return url+'../input/lsr/lilypond-snippets'
130 elif (manual=='changes'):
131 return url+'topdocs/NEWS.html'
132 elif (manual=='music-glossary'):
133 return url+'user/music-glossary'
134 elif (manual=='essay'):
135 return url+'user/lilypond-learning/Background.html'
136 elif (manual=='extending'):
137 return url+'user/lilypond/Interfaces-for-programmers.html'
142 def make_manual_links(name, version):
145 if (m=='music-glossary'):
148 mshort = m.capitalize()
149 url = translateNameToUrl(m, version)
152 # can't have a comma here due to texinfo
153 make_ver_link("manual"+name+mshort+'Pdf',
154 "http://lilypond.org",
155 mshort+" (did not exist in 2.12)")
156 make_ver_link("manual"+name+mshort+'Split',
157 "http://lilypond.org",
158 mshort+" (did not exist in 2.12)")
159 make_ver_link("manual"+name+mshort+'Big',
160 "http://lilypond.org",
161 mshort+" (did not exist in 2.12)")
162 make_ver_link("manual"+name+mshort+'SplitNoName',
163 "http://lilypond.org",
164 mshort+" (did not exist in 2.12)")
166 make_ver_link("manual"+name+mshort+'Pdf',
168 manual.capitalize() + '.pdf')
169 make_ver_link("manual"+name+mshort+'Split',
171 manual.capitalize() + ' (split HTML)')
172 make_ver_link("manual"+name+mshort+'Big',
173 url + '-big-page.html',
174 manual.capitalize() + ' (big HTML)')
175 # this is stupid and I shouldn't have bothered trying
176 # to support the 2.12 docs and it will be deleted once
177 # 2.14 is out and the website won't be visible to users
178 # until 2.14 is out. -gp
179 if (url.endswith('.html')):
182 newurl = url + '/index.html'
183 make_ver_link("manual"+name+mshort+'SplitNoName',
187 def make_regtest_links(name, version):
188 ver_split = version.split('.')
189 ver_minor = ver_split[0] + '.' + ver_split[1]
190 url = depth + "doc/v" + ver_minor + "/input/regression/"
192 make_ver_link("regtest"+name, url+"collated-files.html",
193 "Regression tests for "+version)
194 make_ver_link("regtest"+name+"Pdf", url+"collated-files.pdf",
195 "pdf of "+version+" regtests")
196 make_ver_link("regtest"+name+"Xml", url+"musicxml/collated-files.html",
197 "MusicXML Regression tests for "+version)
198 make_ver_link("regtest"+name+"XmlPdf", url+"musicxml/collated-files.html",
199 "pdf of "+version+" musicxml regtests")
201 def make_doctarball_links(name, version):
202 url = depth + "download/binaries/documentation/lilypond-"
203 # ugly FIXME, but proper build number support isn't Critical.
204 url += version + "-1"
205 url += ".documentation.tar.bz2"
206 make_ver_link("doctarball"+name, url, "Doc tarball for "+version)
208 print "@c ************************ Download binaries ************"
209 make_all_downloads("Stable", VERSION_STABLE)
210 make_all_downloads("Devel", VERSION_DEVEL)
212 print "@c ************************ Download source ************"
213 # FIXME: icky hard-coding! -gp
214 make_download_source("downloadStableSource", "v2.12", VERSION_STABLE)
215 make_download_source("downloadDevelSource", "v2.13", VERSION_DEVEL)
217 print "@c ************************ Manual links ************"
218 make_manual_links("Stable", VERSION_STABLE)
219 make_manual_links("Devel", VERSION_DEVEL)
220 make_doctarball_links("Stable", VERSION_STABLE)
221 make_doctarball_links("Devel", VERSION_DEVEL)
223 print "@c ************************ Regtest links ************"
224 make_regtest_links("Stable", VERSION_STABLE)
225 make_regtest_links("Devel", VERSION_DEVEL)