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;
58 os.environ["CONFIGSUFFIX"] = 'www';
60 os.environ["LILYINCLUDE"] = join (':', __main__.include_path) +':'+ os.environ["LILYINCLUDE"];
61 os.environ["LILYTOP"] = depth;
62 __main__.mailaddress= os.environ['MAILADDRESS']
63 pw = pwd.getpwuid (os.getuid());
65 __main__.fullname= pw[4];
67 backstr = '\n<hr>Please take me <a href=%s>back to the index</a>\n\
68 of LilyPond -- The GNU Project Music typesetter\n\
70 This page was built using <code>%s</code> from lilypond-%s by <p>\n\
71 <address><br>%s <a href=mailto:%s><<!bla>%s</a>></address>\n\
76 return backstr % (index, id_str, lilyversion, fullname, mailaddress, mailaddress)
80 # do something, check return status
91 sys.stderr.write( "ignoring failed command `%s\' (status %d)\n" % (cmd, ret))
93 sys.stderr.write( 'make-website: failed on command %s (status %d)\n' % (cmd, ret))
100 print 'generating HTML'
101 my_system (["make -f Makefile -kC .. html"]);
105 texstuff = ["mudela"]
108 print 'generating TeX doco manuals'
109 list = open('tex_manuals.html', 'w')
110 list.write( "<HTML><TITLE>PostScript Manuals</TITLE>\n"
111 "<BODY><h1>LilyPond manuals (in PostScript)</h1>"
114 for stuff in texstuff:
115 todo = todo + ' out/' + stuff + '.ps.gz'
116 list.write("<li><a href=%s.ps.gz>%s.ps.gz</a>" % (stuff, stuff))
117 list.write('</ul></BODY></HTML>')
120 my_system (['make -C .. ' + todo])
124 print "copying files\n"
126 # my_system ("ln -s depth/out ./docxx" )
127 my_system([ "cp %s/TODO ./TODO.txt" % depth,
128 "cp %s/ANNOUNCE-0.1 ./ANNOUNCE-0.1.txt" % depth,
129 "cp %s/NEWS ./NEWS.txt" % depth,
130 "cp %s/DEDICATION ./DEDICATION.txt" % depth]);
131 my_system([ "make -C .. gifs"]);
135 banner= open('/tmp/lilybanner.html', 'w');
136 banner.write (footstr('../index.html'))
138 my_system(['BANNEROPT=\"-B /tmp/lilybanner.html\" %s/bin/out/make-docxx' % depth]);
139 # os.unlink( "/tmp/lilybanner.html");
144 result = result + glob.glob1('./', '*.' + a)
148 def join(inter, list):
149 return reduce (lambda x,y, i=inter: x + i + y, list)
153 list = get_glob( ['html', 'gif', 'ps.gz' , 'txt', 'midi'])
154 files = join (' ', list)
156 my_system( ['-tar zvhcf website.tar.gz ' + files + ' docxx/*'])
160 print 'This is %s\n' % id_str
163 my_system(['-rm -f /tmp/gs*'])
165 def get_top_of_NEWS():
167 lines = i.readlines()
171 if regex.search('^\*\*\*\*\*\*', l) <> -1:
177 s = gulp_file('index.html')
178 s = regsub.sub ('top_of_NEWS', '<XMP>\n' + get_top_of_NEWS () + '\n</XMP>', s)
179 dump_file ('index.html', s)
182 files = get_glob(['html'])
186 if regex.search(makewebsite_id, s) <> -1:
189 s = regsub.sub ('</BODY>', footstr('index.html') + makewebsite_id + '</BODY>', s)
190 s = regsub.sub('<TITLE>\(.*\)</TITLE>$',
191 '<TITLE>LilyPond WWW: \\1</TITLE>', s)
196 def do_examples (examples, filename):
197 located_files = gen_examples (examples)
198 gen_list (examples, filename)
202 os.chdir (lilydirs.topdir + 'Documentation')
204 # my_system (['-rm ../WWW/*.pod ../WWW/*.xpm ../WWW/*.doc',
205 # 'ln ../Documentation/*.pod ../Documentation/*.doc ../Documentation/*.xpm .']);
206 os.chdir (lilydirs.topdir + 'Documentation/out/')
207 __main__.depth = "../../";
208 __main__.include_path = map(lambda p: __main__.depth + '/' +
209 p, __main__.include_path)
214 do_examples (examples, 'examples_output.html');
215 do_examples (mutopia_examples, 'mutopiaexamples_output.html');