X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=buildscripts%2Fmutopia-index.py;h=50e4ebbf29b5b9355694937acbf228dde47fdd1e;hb=d664f5a7153ec2b1a1c4c9fba2d2174bf3140695;hp=82f5bf007fb4709cd6c07aabf6caef1dcb53dba6;hpb=e63dac8853909a52de02b480bcf3f1718433d09f;p=lilypond.git diff --git a/buildscripts/mutopia-index.py b/buildscripts/mutopia-index.py index 82f5bf007f..50e4ebbf29 100644 --- a/buildscripts/mutopia-index.py +++ b/buildscripts/mutopia-index.py @@ -1,10 +1,9 @@ -#!@PYTHON@ +#!/usr/bin/env python # mutopia-index.py import fnmatch import getopt import os -import os import re import stat import sys @@ -25,7 +24,7 @@ headertext= r"""

LilyPond samples

-

You're looking at a page with some LilyPond samples. These files +

You are looking at a page with some LilyPond samples. These files are also included in the distribution. The output is completely generated from the source file, without any further touch up. @@ -36,7 +35,7 @@ For a good impression of the quality print out the PDF file. """ headertext_nopics= r""" -

Nothing to be seen here, move along. +

No examples were found in this directory. """ # @@ -113,15 +112,9 @@ hr { border:0; height:1; color: #000000; background-color: #000000; }\n ext = ext2 + ext header = read_lilypond_header (ex) - def read_dict (s, default, h = header): - try: - ret = h[s] - except KeyError: - ret = default - return ret - head = read_dict ('title', os.path.basename (base)) - composer = read_dict ('composer', '') - desc = read_dict ('description', '') + head = header.get ('title', os.path.basename (base)) + composer = header.get ('composer', '') + desc = header.get ('description', '') list.write ('


\n') list.write ('

%s

\n' % head); if composer: @@ -148,7 +141,7 @@ hr { border:0; height:1; color: #000000; background-color: #000000; }\n pictures = ['jpeg', 'png', 'xpm'] lst.write ('\n') else: - print "can't find" , `file_name` + print "cannot find" , `file_name` list_item (base + ext, 'The input', 'ASCII') @@ -173,14 +166,12 @@ hr { border:0; height:1; color: #000000; background-color: #000000; }\n list.write ('\n'); list.close () -(options, files) = getopt.getopt (sys.argv[1:], +(options, files) = getopt.getopt (sys.argv[1:], 'ho:', ['help', 'output=']) outfile = 'examples.html' subdirs = [] -for opt in options: - o = opt[0] - a = opt[1] +for (o, a) in options: if o == '--help' or o == '-h': help () elif o == '--output' or o == '-o': @@ -188,7 +179,7 @@ for opt in options: dirs = [] for f in files: - dirs = dirs + find ('out-www', f) + dirs += find ('out-www', f) if not dirs: dirs = ['.'] @@ -196,7 +187,11 @@ if not dirs: allfiles = [] for d in dirs: - allfiles = allfiles + find ('*.ly.txt', d) + allfiles += find ('*.ly', d) -gen_list (allfiles, outfile) +allfiles = [f for f in allfiles + if not f.endswith ('snippet-map.ly') + and not re.search ('lily-[0-9a-f]+', f) + and 'musicxml' not in f] +gen_list (allfiles, outfile)