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 ### just like depth in our GNUmakefiles
14 # these links are relative from /~graham/web/
16 # these links are relative from the v2.13 docs
17 #depth = "../../../../"
19 # FIXME: remove the user/lilypond- when 2.14 becomes stable
20 WEB_DOCLINK_STABLE = depth + "doc/v2.12/Documentation/user/lilypond-"
21 WEB_DOCLINK_DEVEL = depth + "doc/v2.13/Documentation/"
31 myDir = os.path.dirname(sys.argv[0])
32 # use two abspaths to work around some windows python bug
33 topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
34 topDir = os.path.abspath( topDir )
37 # TODO: this might be useful for other scripts; can we make it available?
38 manuals = map(lambda x: os.path.splitext(x)[0],
40 glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
41 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
42 manuals.append('internals')
45 version_file_path = os.path.join(topDir, "VERSION")
47 version_contents = open(version_file_path).readlines()
51 for line in version_contents:
52 if (line[0:13] == 'MAJOR_VERSION'):
54 if (line[0:13] == 'MINOR_VERSION'):
56 if (line[0:11] == 'PATCH_LEVEL'):
58 if (line[0:14] == 'VERSION_STABLE'):
59 VERSION_STABLE = line[15:-1]
60 if (line[0:13] == 'VERSION_DEVEL'):
61 VERSION_DEVEL = line[14:-1]
63 VERSION = str(major)+'.'+str(minor)+'.'+str(patch)
65 def make_macro(name, string):
71 def make_download(name, osA, osB, version, revision, text):
72 string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
73 string += osA + "lilypond-"
74 string += version + "-" + revision
75 string += "." + osB + ",\n"
77 string += ": LilyPond "
78 string += version + "-" + revision
80 make_macro(name, string)
82 def make_download_source(name, vstring, version):
83 string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
84 string += vstring + "/"
85 string += "lilypond-" + version + ".tar.gz"
87 string += "lilypond-" + version + ".tar.gz"
89 make_macro(name, string)
91 def make_all_downloads(macroName, version):
92 make_download("download"+macroName+"LinuxNormal", "linux-x86/",
93 "linux-x86.sh", version, "1", "Linux x86")
94 make_download("download"+macroName+"LinuxBig", "linux-64/",
95 "linux-64.sh", version, "1", "Linux 64")
96 make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
97 "linux-ppc.sh", version, "1", "Linux PPC")
99 make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
100 "freebsd-x86.sh", version, "1", "FreeBSD i386")
101 make_download("download"+macroName+"FreeBSDBig", "freebsd-x86/",
102 "freebsd-64.sh", version, "1", "FreeBSD amd64")
104 make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
105 "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
106 make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
107 "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
109 make_download("download"+macroName+"Windows", "mingw/",
110 "mingw.exe", version, "1", "Windows")
112 def make_ver_link(macroname, version, url, linktext):
114 # TODO: generalize this
115 if (version[:4] == '2.13'):
116 string += WEB_DOCLINK_DEVEL
117 if (version[:4] == '2.12'):
118 string += WEB_DOCLINK_STABLE
123 make_macro(macroname, string)
125 def make_manual_links(name, version):
127 # FIXME: this is disgusting
129 #mshort = 'glossary' if m=='music-glossary' else m
130 # grr, GUB only has python 2.4.5. :(
131 if (m=='music-glossary'):
135 make_ver_link("manual"+name+mshort.capitalize()+'Pdf',
138 manual.capitalize() + '.pdf')
139 make_ver_link("manual"+name+mshort.capitalize()+'Split',
141 manual+'/index.html',
142 manual.capitalize() + ' (split HTML)')
143 make_ver_link("manual"+name+mshort.capitalize()+'Big',
145 manual+'-big-page.html',
146 manual.capitalize() + ' (big HTML)')
149 print "@c ************************ Version numbers ************"
150 make_macro("version", VERSION)
151 make_macro("versionStable", VERSION_STABLE)
152 make_macro("versionDevel", VERSION_DEVEL)
154 print "@c ************************ Download binaries ************"
155 make_all_downloads("Stable", VERSION_STABLE)
156 make_all_downloads("Devel", VERSION_DEVEL)
158 print "@c ************************ Download source ************"
159 # FIXME: icky hard-coding! -gp
160 make_download_source("downloadStableSource", "v2.12", VERSION_STABLE)
161 make_download_source("downloadDevelSource", "v2.13", VERSION_DEVEL)
163 print "@c ************************ Manual links ************"
164 make_manual_links("Stable", VERSION_STABLE)
165 make_manual_links("Devel", VERSION_DEVEL)