#
# source file of the GNU LilyPond music typesetter
#
-# (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+# (c) 1997, 1998 Han-Wen Nienhuys <hanwen@stack.nl>
#
"""
stupid script to generate WWW site.
The WWW site is my test-suite for LilyPond, I usually don't
- distribute versions that fail to complete this script """
+ distribute versions that fail to complete this script
+You should set the following environment vars:
+
+LILYPOND_SOURCEDIR
+TEXINPUTS
+MAILADDRESS
+
+
+ """
+
+import sys
+import os
+
+lilypath =''
+try:
+ lilypath = os.environ['LILYPOND_SOURCEDIR'] + '/'
+except KeyError:
+ print 'Please set LILYPOND_SOURCEDIR to the toplevel source, eg LILYPOND_SOURCEDIR=/home/foobar/lilypond-1.2.3/'
+ sys.exit(1)
+
+lilypath = lilypath + '/bin/'
+sys.path.append(lilypath)
+
from lilypython import *
import __main__
import glob
depth = ''
makewebsite_id = "<!make_website!>";
-id_str = "make-website 0.6";
+id_str = "make-website 0.8";
tar = "tar";
make = "make";
mailaddress = "unknown"
footstr = ""
lilyversion= ''
+include_path=[ 'input', 'mutopia' , 'mutopia/J.S.Bach',
+ 'mutopia/J.S.Bach/out' ]
+
def set_vars():
__main__.lilyversion = version_tuple_to_str(lilydirs.version_tuple())
os.environ["TEXINPUTS"] = os.environ["TEXINPUTS"] + ":%s/input/:" % depth;
- os.environ["LILYINCLUDE"] = "%s/input/" % depth;
+
+ os.environ["LILYINCLUDE"] = join (':', __main__.include_path)
os.environ["LILYTOP"] = depth;
__main__.mailaddress= os.environ['MAILADDRESS']
pw = pwd.getpwuid (os.getuid());
of LilyPond -- The GNU Project Music typesetter\n\
<hr><font size=-1>\n\
This page was built using <code>%s</code> from lilypond-%s by <p>\n\
-<address><br>%s <a href=mailto:%s&>><<!bla>%s</a>></address>\n\
+<address><br>%s <a href=mailto:%s><<!bla>%s</a>></address>\n\
<p></font>'
base="lilypond/";
examples=["twinkle-pop",
- "wtk1-fugue2",
- "standchen-16",
- "standchen-20",
- "wtk1-prelude1",
- "toccata-fuga-E",
- "scsii-menuetto",
- "cadenza",
- "gallina",
- "twinkle",
- "collisions",
- "font",
- "font20",
- #"scales",
- "rhythm",
- "multi"]
+ "praeludium-fuga-E",
+ "cadenza",
+ "twinkle",
+ "collisions",
+ "font16",
+ "font20",
+ #"scales",
+ "rhythm",
+ "multi"]
+
+mutopia_examples = [ "wtk1-fugue2",
+ "standje",
+ "preludes-1",
+ "preludes-2",
+ "wtk1-prelude1",
+ "gallina",
+ "scsii-menuetto"]
+
def gen_html():
print 'generating HTML'
my_system (["make -kC .. html"]);
-def gen_examples():
+def gen_examples(inputs):
print 'generating examples:\n'
- list = map(lambda x: 'out/%s.ps.gz out/%s.gif out/%s.ly.txt' % (x,x,x), examples)
+ outputs = []
+ for i in inputs:
+ try:
+ located = multiple_find ([i + '.ly'], include_path) [0]
+ except IndexError:
+ print 'continuing dazed & confused (%s) ' % i
+ continue
+ outputs.append (located)
+ if not file_exist_b(i + '.dvi'):
+ my_system (['ly2dvi %s' % located])
+ if not file_exist_b(i + '.ly.txt'):
+ os.link (located, i + ".ly.txt")
+ list = map(lambda x: 'out/%s.ps.gz out/%s.gif' % (x,x), inputs)
my_system (['make -C .. ' + join(' ', list)])
-texstuff = ["mudela-man", "mudela-course"]
-
-def gen_manuals():
- print 'generating TeX doco manuals'
- list = open('tex_manuals.html', 'w')
- list.write( "<HTML><TITLE>PostScript Manuals</TITLE>\n"
- "<BODY><h1>LilyPond manuals (in PostScript)</h1>"
- "<ul>\n")
- todo=''
- for stuff in texstuff:
- todo = todo + ' out/' + stuff + '.ps.gz'
- list.write("<li><a href=%s.ps.gz>%s.ps.gz</a>" % (stuff, stuff))
- list.write('</ul></BODY></HTML>')
- list.close ()
-
- my_system (['make -C .. ' + todo])
-
-def file_exist_b(name):
- try:
- f = open(name)
- except IOError:
- return 0
- f.close ()
- return 1
+ return outputs
-def gen_list():
- print "generating HTML list\n";
- list = open('example_output.html', 'w')
+def gen_list(inputs, filename):
+ print "generating HTML list %s\n" % filename;
+ list = open(filename, 'w')
list.write ('<html><TITLE>Rendered Examples</TITLE>\n'
'<body>These example files are taken from the LilyPond distribution.\n'
'LilyPond currently only outputs TeX and MIDI. The pictures and\n'
'graphics tools. The papersize used for these examples is A4. The GIF\n'
'files have been scaled to eliminate aliasing.\n');
- for ex in examples:
+ for ex in inputs:
+ print '%s, ' % ex
header = read_mudela_header(ex + '.ly.txt')
+
def read_dict(s, default, h =header):
try:
ret = h[s]
list.write( "</BODY></HTML>");
list.close()
+texstuff = ["mudela-man", "mudela-course"]
+
+def gen_manuals():
+ print 'generating TeX doco manuals'
+ list = open('tex_manuals.html', 'w')
+ list.write( "<HTML><TITLE>PostScript Manuals</TITLE>\n"
+ "<BODY><h1>LilyPond manuals (in PostScript)</h1>"
+ "<ul>\n")
+ todo=''
+ for stuff in texstuff:
+ todo = todo + ' out/' + stuff + '.ps.gz'
+ list.write("<li><a href=%s.ps.gz>%s.ps.gz</a>" % (stuff, stuff))
+ list.write('</ul></BODY></HTML>')
+ list.close ()
+
+ my_system (['make -C .. ' + todo])
+
+def file_exist_b(name):
+ try:
+ f = open(name)
+ except IOError:
+ return 0
+ f.close ()
+ return 1
def copy_files():
print "copying files\n"
s = regsub.sub ('</BODY>', footstr('index.html') + makewebsite_id + '</BODY>', s)
s = regsub.sub('<TITLE>\(.*\)</TITLE>$',
'<TITLE>LilyPond WWW: \\1</TITLE>', s)
+
dump_file (f,s)
+
+def do_examples (examples, filename):
+ located_files = gen_examples (examples)
+ gen_list (examples, filename)
def main():
identify();
os.chdir (lilydirs.topdir + 'Documentation/out')
__main__.depth = "../../";
+ __main__.include_path = map(lambda p: __main__.depth + '/' +
+ p, __main__.include_path)
set_vars();
gen_html();
copy_files();
- gen_examples();
- gen_list();
+ do_examples (examples, 'examples_output.html');
+ do_examples (mutopia_examples, 'mutopiaexamples_output.html');
gen_manuals();
#set_images();
edit_html();