]> git.donarmstrong.com Git - lilypond.git/blob - scripts/build/create-version-itexi.py
Web build: more prep for online website.
[lilypond.git] / scripts / build / create-version-itexi.py
1 #!@PYTHON@
2 # create-version-itexi.py
3
4 import sys
5 import os
6 import glob
7
8 ### just like depth in our GNUmakefiles
9 # these links are relative from /~graham/web/
10 depth = "../../"
11 # these links are relative from the v2.13 docs
12 #depth = "../../../../"
13
14 # FIXME: remove the user/lilypond-  when 2.14 becomes stable
15 WEB_DOCLINK_STABLE = depth + "doc/v2.12/Documentation/user/lilypond-"
16 WEB_DOCLINK_DEVEL  = depth + "doc/v2.13/Documentation/"
17
18
19
20 VERSION_STABLE = ""
21 VERSION_DEVEL = ""
22
23 myDir = os.path.dirname(sys.argv[0])
24 # use two abspaths to work around some windows python bug
25 topDir = os.path.join(os.path.abspath(myDir)+os.sep+'..'+os.sep+'..'+os.sep)
26 topDir = os.path.abspath( topDir )
27
28 # TODO: this might be useful for other scripts; can we make it available?
29 manuals = map(lambda x: os.path.splitext(x)[0],
30               map(os.path.basename,
31                   glob.glob(os.path.join(topDir,'Documentation', '*.te??'))))
32 #manuals = map(lambda x: 'glossary' if x=='music-glossary' else x, manuals)
33 manuals.append('internals')
34
35
36 version_file_path = os.path.join(topDir, "VERSION")
37
38 version_contents = open(version_file_path).readlines()
39 for line in version_contents:
40         if (line[0:14] == 'VERSION_STABLE'):
41                 VERSION_STABLE = line[15:-1]
42         if (line[0:13] == 'VERSION_DEVEL'):
43                 VERSION_DEVEL = line[14:-1]
44
45 def make_macro(name, string):
46         print "@macro", name
47         print string
48         print "@end macro"
49         print ""
50
51 def make_download(name, osA, osB, version, revision, text):
52         string = "@uref{http://download.linuxaudio.org/lilypond/binaries/"
53         string += osA + "lilypond-"
54         string += version + "-" + revision
55         string += "." + osB + ",\n"
56         string += text
57         string += ": LilyPond "
58         string += version + "-" + revision
59         string += "}"
60         make_macro(name, string)
61
62 def make_download_source(name, vstring, version):
63         string = "@uref{http://download.linuxaudio.org/lilypond/sources/"
64         string += vstring + "/"
65         string += "lilypond-" + version + ".tar.gz"
66         string += ", "
67         string += "lilypond-" + version + ".tar.gz"
68         string += "}"
69         make_macro(name, string)
70
71 def make_all_downloads(macroName, version):
72         make_download("download"+macroName+"LinuxNormal", "linux-x86/",
73                 "linux-x86.sh", version, "1", "Linux x86")
74         make_download("download"+macroName+"LinuxBig", "linux-64/",
75                 "linux-64.sh", version, "1", "Linux 64")
76         make_download("download"+macroName+"LinuxPPC", "linux-ppc/",
77                 "linux-ppc.sh", version, "1", "Linux PPC")
78         
79         make_download("download"+macroName+"FreeBSDNormal", "freebsd-x86/",
80                 "freebsd-x86.sh", version, "1", "FreeBSD i386")
81         make_download("download"+macroName+"FreeBSDBig", "freebsd-x86/",
82                 "freebsd-64.sh", version, "1", "FreeBSD amd64")
83         
84         make_download("download"+macroName+"DarwinNormal", "darwin-x86/",
85                 "darwin-x86.tar.bz2", version, "1", "MacOS X x86")
86         make_download("download"+macroName+"DarwinPPC", "darwin-ppc/",
87                 "darwin-ppc.tar.bz2", version, "1", "MacOS X PPC")
88
89         make_download("download"+macroName+"Windows", "mingw/",
90                 "mingw.exe", version, "1", "Windows")
91
92 def make_ver_link(macroname, version, url, linktext):
93         string = "@uref{"
94         # TODO: generalize this
95         if (version[:4] == '2.13'):
96                 string += WEB_DOCLINK_DEVEL
97         if (version[:4] == '2.12'):
98                 string += WEB_DOCLINK_STABLE
99         string += url
100         string += ","
101         string += linktext
102         string += "}"
103         make_macro(macroname, string)
104
105 def make_manual_links(name, version):
106         for m in manuals:
107                 # FIXME: this is disgusting
108                 manual = m
109                 mshort = 'glossary' if m=='music-glossary' else m
110                 make_ver_link("manual"+name+mshort.capitalize()+'Pdf',
111                           version,
112                           manual + '.pdf',
113                           manual.capitalize() + '.pdf')
114                 make_ver_link("manual"+name+mshort.capitalize()+'Split',
115                           version,
116                           manual+'/index.html',
117                           manual.capitalize() + ' (split HTML)')
118                 make_ver_link("manual"+name+mshort.capitalize()+'Big',
119                           version,
120                           manual+'-big-page.html',
121                           manual.capitalize() + ' (big HTML)')
122
123
124 print "@c ************************ Version numbers ************"
125 make_macro("versionStable", VERSION_STABLE)
126 make_macro("versionDevel", VERSION_DEVEL)
127
128 print "@c ************************ Download binaries ************"
129 make_all_downloads("Stable", VERSION_STABLE)
130 make_all_downloads("Devel", VERSION_DEVEL)
131
132 print "@c ************************ Download source ************"
133 # FIXME: icky hard-coding!  -gp
134 make_download_source("downloadStableSource", "v2.12", VERSION_STABLE)
135 make_download_source("downloadDevelSource", "v2.13", VERSION_DEVEL)
136
137 print "@c ************************ Manual links ************"
138 make_manual_links("Stable", VERSION_STABLE)
139 make_manual_links("Devel", VERSION_DEVEL)
140
141
142