3 # make-website.py -- implement The lilypond WWW site
5 # source file of the GNU LilyPond music typesetter
7 # (c) 1997, 1998 Han-Wen Nienhuys <hanwen@stack.nl>
11 stupid script to generate WWW site.
13 The WWW site is my test-suite for LilyPond, I usually don't
14 distribute versions that fail to complete this script
16 You should set the following environment vars:
30 lilypath = os.environ['LILYPOND_SOURCEDIR'] + '/'
32 print 'Please set LILYPOND_SOURCEDIR to the toplevel source, eg LILYPOND_SOURCEDIR=/home/foobar/lilypond-1.2.3/'
35 lilypath = lilypath + '/bin/'
36 sys.path.append(lilypath)
38 from lilypython import *
43 makewebsite_id = "<!make_website!>";
44 id_str = "make-website 0.9";
46 make = "make -f Makefile outdir=out-www";
47 mailaddress = "unknown"
52 include_path=[ 'input', 'mutopia' , 'mutopia/J.S.Bach', 'mutopia/Coriolan',
53 'mutopia/J.S.Bach/out' ]
56 __main__.lilyversion = version_tuple_to_str(lilydirs.version_tuple())
57 os.environ["TEXINPUTS"] = os.environ["TEXINPUTS"] + ":%s/input/:" % depth;
59 os.environ["LILYINCLUDE"] = join (':', __main__.include_path) +':'+ os.environ["LILYINCLUDE"];
60 os.environ["LILYTOP"] = depth;
61 __main__.mailaddress= os.environ['MAILADDRESS']
62 pw = pwd.getpwuid (os.getuid());
64 __main__.fullname= pw[4];
66 backstr = '\n<hr>Please take me <a href=%s>back to the index</a>\n\
67 of LilyPond -- The GNU Project Music typesetter\n\
69 This page was built using <code>%s</code> from lilypond-%s by <p>\n\
70 <address><br>%s <a href=mailto:%s><<!bla>%s</a>></address>\n\
75 return backstr % (index, id_str, lilyversion, fullname, mailaddress, mailaddress)
79 # do something, check return status
90 sys.stderr.write( "ignoring failed command `%s\' (status %d)\n" % (cmd, ret))
92 sys.stderr.write( 'make-website: failed on command %s (status %d)\n' % (cmd, ret))
99 print 'generating HTML'
100 my_system (["make -f Makefile -kC .. html"]);
104 texstuff = ["mudela"]
107 print 'generating TeX doco manuals'
108 list = open('tex_manuals.html', 'w')
109 list.write( "<HTML><TITLE>PostScript Manuals</TITLE>\n"
110 "<BODY><h1>LilyPond manuals (in PostScript)</h1>"
113 for stuff in texstuff:
114 todo = todo + ' out/' + stuff + '.ps.gz'
115 list.write("<li><a href=%s.ps.gz>%s.ps.gz</a>" % (stuff, stuff))
116 list.write('</ul></BODY></HTML>')
119 my_system (['make -C .. ' + todo])
123 print "copying files\n"
125 # my_system ("ln -s depth/out ./docxx" )
126 my_system([ "cp %s/TODO ./TODO.txt" % depth,
127 "cp %s/ANNOUNCE-0.1 ./ANNOUNCE-0.1.txt" % depth,
128 "cp %s/NEWS ./NEWS.txt" % depth,
129 "cp %s/DEDICATION ./DEDICATION.txt" % depth]);
130 my_system([ "make -C .. gifs"]);
134 banner= open('/tmp/lilybanner.html', 'w');
135 banner.write (footstr('../index.html'))
137 my_system(['BANNEROPT=\"-B /tmp/lilybanner.html\" %s/bin/out/make-docxx' % depth]);
138 # os.unlink( "/tmp/lilybanner.html");
143 result = result + glob.glob1('./', '*.' + a)
147 def join(inter, list):
148 return reduce (lambda x,y, i=inter: x + i + y, list)
152 list = get_glob( ['html', 'gif', 'ps.gz' , 'txt', 'midi'])
153 files = join (' ', list)
155 my_system( ['-tar zvhcf website.tar.gz ' + files + ' docxx/*'])
159 print 'This is %s\n' % id_str
162 my_system(['-rm -f /tmp/gs*'])
164 def get_top_of_NEWS():
166 lines = i.readlines()
170 if regex.search('^\*\*\*\*\*\*', l) <> -1:
176 s = gulp_file('index.html')
177 s = regsub.sub ('top_of_NEWS', '<XMP>\n' + get_top_of_NEWS () + '\n</XMP>', s)
178 dump_file ('index.html', s)
181 files = get_glob(['html'])
185 if regex.search(makewebsite_id, s) <> -1:
188 s = regsub.sub ('</BODY>', footstr('index.html') + makewebsite_id + '</BODY>', s)
189 s = regsub.sub('<TITLE>\(.*\)</TITLE>$',
190 '<TITLE>LilyPond WWW: \\1</TITLE>', s)
195 def do_examples (examples, filename):
196 located_files = gen_examples (examples)
197 gen_list (examples, filename)
201 os.chdir (lilydirs.topdir + 'Documentation')
203 # my_system (['-rm ../WWW/*.pod ../WWW/*.xpm ../WWW/*.doc',
204 # 'ln ../Documentation/*.pod ../Documentation/*.doc ../Documentation/*.xpm .']);
205 os.chdir (lilydirs.topdir + 'Documentation/out/')
206 __main__.depth = "../../";
207 __main__.include_path = map(lambda p: __main__.depth + '/' +
208 p, __main__.include_path)
213 do_examples (examples, 'examples_output.html');
214 do_examples (mutopia_examples, 'mutopiaexamples_output.html');