X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=buildscripts%2Fmutopia-index.py;h=57a9a3f3d51383d84b7574b3b6aa1f3e96c19857;hb=02c0ae5243230b7b2aeba704ac2583a813adaac1;hp=794e59929ec1b6fac3589edf0c908ad8e277eb1d;hpb=a96faf44452c408fb5cce3a9ac5b6f5b3f509d48;p=lilypond.git diff --git a/buildscripts/mutopia-index.py b/buildscripts/mutopia-index.py old mode 100755 new mode 100644 index 794e59929e..57a9a3f3d5 --- a/buildscripts/mutopia-index.py +++ b/buildscripts/mutopia-index.py @@ -1,202 +1,206 @@ #!@PYTHON@ # mutopia-index.py -name = 'mutopia-index' - -# find.py -- deprecated in python 2.0 import fnmatch +import getopt import os - -_debug = 0 - -_prune = ['(*)'] - -def find(pattern, dir = os.curdir): - list = [] - names = os.listdir(dir) - names.sort() - for name in names: - if name in (os.curdir, os.pardir): - continue - fullname = os.path.join(dir, name) - if fnmatch.fnmatch(name, pattern): - list.append(fullname) - if os.path.isdir(fullname) and not os.path.islink(fullname): - for p in _prune: - if fnmatch.fnmatch(name, p): - if _debug: print "skip", `fullname` - break - else: - if _debug: print "descend into", `fullname` - list = list + find(pattern, fullname) - return list - - -import re import os -import sys +import re import stat +import sys -def gulp_file (fn): - try: - f = open (fn) - except: - raise 'not there' , fn - return f.read () +def find (pat, dir): + f = os.popen ('find %s -name "%s"'% (dir, pat)) + lst = [] + for a in f.readlines(): + a = a[:-1] + lst.append (a) + return lst -def file_exist_b (fn): - try: - f = open (fn) - return 1 - except: - return 0 +junk_prefix = 'out-www/' headertext= r""" -
You're looking at a page with some LilyPond samples. -These files are also included in the distribution. The output is -completely generated by LilyPond, without any touch up by humans. -
The PostScript files were generated using TeX and dvips. The pictures -are 90dpi anti-aliased snapshots of the printed output. The images -are in PNG format, and should be viewable with any current browser. +
If you want a better impression of the appearance, do print out one of -the postscript files. + +
You're 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. + +
+ +The pictures are 90 dpi anti-aliased snapshots of the printed output. +For a good impression of the quality print out the PDF file. """ +headertext_nopics= r""" +
No examples were found in this directory. +""" # # FIXME breaks on multiple strings. # def read_lilypond_header (fn): - s = open(fn).read () - s = re.sub('%.*$', '', s) - s = re.sub('\n', ' ', s) + s = open (fn).read () + s = re.sub ('%.*$', '', s) + s = re.sub ('\n', ' ', s) - dict = {} - m = re.search (r"""\\header\s*{([^}]*)}""", s) + dict = {} + m = re.search (r"""\\header\s*{([^}]*)}""", s) - if m: - s = m.group(1) - else: - return dict + if m: + s = m.group (1) + else: + return dict - while s: - m = re.search (r"""\s*(\S+)\s*=\s*([^;]+)\s*;""", s) - if m == None: - s = '' - else: - s = s[m.end (0):] - left = m.group (1) - right = m.group (2) + while s: + m = re.search (r'''\s*(\S+)\s*=\s*"([^"]+)"''', s) + if m == None: + s = '' + else: + s = s[m.end (0):] + left = m.group (1) + right = m.group (2) - left = re.sub ('"', '', left) - right = re.sub ('"', '', right) - dict[left] = right + left = re.sub ('"', '', left) + right = re.sub ('"', '', right) + dict[left] = right - return dict + return dict def help (): - sys.stdout.write (r"""Usage: mutopia-index [options] INFILE OUTFILE -Generate index for mutopia\n + sys.stdout.write (r'''Usage: mutopia-index [OPTIONS] INFILE OUTFILE +Generate index for mutopia. + Options: - -h, --help print this help - -o,-output=FILE write output to file. - -s, --subdirs=DIR add subdir - --suffix=SUF specify suffix""" - ) - sys.exit (0) + -h, --help print this help + -o, --output=FILE write output to file + -s, --subdirs=DIR add subdir + --suffix=SUF specify suffix + +''') + sys.exit (0) # ugh. -def gen_list(inputs, filename): - print "generating HTML list %s\n" % filename - if filename: - list = open(filename, 'w') - else: - list = sys.stdout - list.write ('
' % desc) - list.write ('
' % desc) + list.write ('