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