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. """
13 # FIXME: if the depth depends on the type of build, figure it
15 ### just like depth in our GNUmakefiles
16 # these links are relative from /~graham/web/
18 # these links are relative from the v2.13 docs
19 #depth = "../../../../"
29 myDir = os.path.dirname(sys.argv[0])
30 # use two abspaths to work around some windows python bug
31 topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
32 topDir = os.path.abspath( topDir )
35 # TODO: this might be useful for other scripts; can we make it available?
36 manuals = map(lambda x: os.path.splitext(x)[0],
38 glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
39 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
40 manuals.append('internals')
43 version_file_path = os.path.join(topDir, "VERSION")
45 version_contents = open(version_file_path).readlines()
49 for line in version_contents:
50 if (line.startswith('MAJOR_VERSION')):
52 if (line.startswith('MINOR_VERSION')):
54 if (line.startswith('PATCH_LEVEL')):
56 if (line.startswith('VERSION_STABLE')):
57 VERSION_STABLE = line[15:-1]
58 if (line.startswith('VERSION_DEVEL')):
59 VERSION_DEVEL = line[14:-1]
61 VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
63 def make_macro(name, string):
69 def make_download(name, osA, osB, version, revision, text):
70 string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
71 string += osA + "lilypond-"
72 string += version + "-" + revision
73 string += "." + osB + ",\n"
75 string += ": LilyPond "
76 string += version + "-" + revision
78 make_macro(name, string)
80 def make_download_source(name, vstring, version):
81 string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
82 string += vstring + "/"
83 string += "lilypond-" + version + ".tar.gz"
85 string += "lilypond-" + version + ".tar.gz"
87 make_macro(name, string)
89 def make_all_downloads(macroName, version):
90 make_download("download"+macroName+"LinuxNormal", "linux-x86/",
91 "linux-x86.sh", version, "1", "Linux x86")
92 make_download("download"+macroName+"LinuxBig", "linux-64/",
93 "linux-64.sh", version, "1", "Linux 64")
94 make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
95 "linux-ppc.sh", version, "1", "Linux PPC")
97 make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
98 "freebsd-x86.sh", version, "1", "FreeBSD i386")
99 make_download("download"+macroName+"FreeBSDBig", "freebsd-x86/",
100 "freebsd-64.sh", version, "1", "FreeBSD amd64")
102 make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
103 "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
104 make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
105 "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
107 make_download("download"+macroName+"Windows", "mingw/",
108 "mingw.exe", version, "1", "Windows")
110 def make_ver_link(macroname, version, url, linktext):
116 make_macro(macroname, string)
118 # TODO: this kind of thing should really be in a central place for
119 # lilypond python build scripts
120 def translateNameToUrl(manual, version):
121 ver_split = version.split('.')
122 ver_minor = ver_split[0] + '.' + ver_split[1]
123 url = depth + "doc/v" + ver_minor + "/Documentation/"
125 if (ver_minor == '2.13'):
127 if (ver_minor == '2.12'):
128 if (manual=='learning'):
129 return url+'user/lilypond-learning'
130 elif (manual=='internals'):
131 return url+'user/lilypond-internals'
132 elif (manual=='notation'):
133 return url+'user/lilypond'
134 elif (manual=='usage'):
135 return url+'user/lilypond-program'
136 elif (manual=='snippets'):
137 return url+'../input/lsr/lilypond-snippets'
138 elif (manual=='changes'):
139 return url+'topdocs/NEWS.html'
140 elif (manual=='music-glossary'):
141 return url+'user/music-glossary'
142 elif (manual=='essay'):
143 return url+'user/lilypond-learning/Background.html'
144 elif (manual=='extending'):
145 return url+'user/music/Interfaces-for-programmers.html'
150 def make_manual_links(name, version):
153 if (m=='music-glossary'):
156 mshort = m.capitalize()
157 url = translateNameToUrl(m, version)
161 # can't have a comma here due to texinfo
162 make_ver_link("manual"+name+mshort+'Pdf',
163 version, "http://lilypond.org",
164 mshort+" (did not exist in 2.12)")
165 make_ver_link("manual"+name+mshort+'Split',
166 version, "http://lilypond.org",
167 mshort+" (did not exist in 2.12)")
168 make_ver_link("manual"+name+mshort+'Big',
169 version, "http://lilypond.org",
170 mshort+" (did not exist in 2.12)")
171 make_ver_link("manual"+name+mshort+'SplitNoName',
172 version, "http://lilypond.org",
173 mshort+" (did not exist in 2.12)")
175 make_ver_link("manual"+name+mshort+'Pdf',
178 manual.capitalize() + '.pdf')
179 make_ver_link("manual"+name+mshort+'Split',
182 manual.capitalize() + ' (split HTML)')
183 make_ver_link("manual"+name+mshort+'Big',
185 url + '-big-page.html',
186 manual.capitalize() + ' (big HTML)')
187 # this is stupid and I shouldn't have bothered trying
188 # to support the 2.12 docs and it will be deleted once
189 # 2.14 is out and the website won't be visible to users
190 # until 2.14 is out. -gp
191 if (url.endswith('.html')):
194 newurl = url + '/index.html'
195 make_ver_link("manual"+name+mshort+'SplitNoName',
201 print "@c ************************ Version numbers ************"
202 make_macro("version", VERSION)
203 make_macro("versionStable", VERSION_STABLE)
204 make_macro("versionDevel", VERSION_DEVEL)
206 print "@c ************************ Download binaries ************"
207 make_all_downloads("Stable", VERSION_STABLE)
208 make_all_downloads("Devel", VERSION_DEVEL)
210 print "@c ************************ Download source ************"
211 # FIXME: icky hard-coding! -gp
212 make_download_source("downloadStableSource", "v2.12", VERSION_STABLE)
213 make_download_source("downloadDevelSource", "v2.13", VERSION_DEVEL)
215 print "@c ************************ Manual links ************"
216 make_manual_links("Stable", VERSION_STABLE)
217 make_manual_links("Devel", VERSION_DEVEL)