import glob
import os
+import re
+import sys
here = os.getcwd ()
reldir = str (Dir ('.').srcnode ())
pss = map (e.PostScript, map (lambda x: x + '.dvi', doc_stems))
pdfs = map (e.Dvi2pdf, doc_stems)
+
+def file_subst (file_name, find, subst):
+ find_re = re.compile (find, re.MULTILINE)
+ s = open (file_name).read ()
+ t = re.sub (find_re, subst, s)
+ if s != t:
+ os.rename (file_name, file_name + '~')
+ h = open (file_name, "w")
+ h.write (t)
+ h.close ()
+
docdir = os.path.join (env['srcdir'], 'Documentation')
out = env['out']
srcdir = env['srcdir']
-##MAKEINFO_INCLUDES = join_path (env['MAKEINFO_PATH'], '', ' -I')
-##MAKEINFO = env['MAKEINFO']
-# TODO: purl (ugh?), symlinks
verbose = verbose_opt (env, ' --verbose')
a = ('makeinfo -I%(reldir)s -I${SOURCE.dir}'\
+ ' --output=${TARGET.dir}'\
+ ' --css-include=%(docdir)s/texinfo.css' \
+ ' --html --no-split --no-headers %(verbose)s' \
+ ' $SOURCE') % vars ()
-e.Command ('lilypond/lilypond.html', 'lilypond.texi', a)
+def url_fixup (target, source, env):
+ file_subst (str (target[0]),
+ '\.\./lilypond-internals', 'lilypond-internals/')
+c = 'pwd; ln -f %(userbuild)s/*.png %(userbuild)s/*.ly ${TARGET.dir}/' % vars ()
+e.Command ('lilypond/lilypond.html', 'lilypond.texi', [a, url_fixup, c])
e.Command ('lilypond-internals/lilypond-internals.html',
'lilypond-internals.texi', a)
## emitter = add_ps_target)
env.Append (BUILDERS = {'LilyPond': lilypond})
-verbose = verbose_opt (env, ' --verbose')
+#verbose = verbose_opt (env, ' --verbose')
+verbose = ''
a = ('LILYPONDPREFIX=%(LILYPONDPREFIX)s '\
+ '%(PYTHON)s %(ABC2LY_PY)s%(verbose)s'\
- + ' --include=${TARGET.dir}'\
+# + ' --include=${TARGET.dir}'\
+ + ' --strict'\
+ ' --output=${TARGET.base}'\
+ ' $SOURCE') % vars ()
abc2ly = Builder (action = a, suffix = '.ly', src_suffix = '.abc')
return ''
# UGH, should fix --output option for mftrace
-xpfa = Builder (action = ('MFINPUTS=.:' + str (Dir ('#/mf')) \
- + ' mftrace -I %(outdir)s --pfa' \
- + ' --simplify --keep-trying' \
- + ' ${SOURCE.filebase} ' \
- + ' && mv ${TARGET.filebase} $TARGET') % vars (),
+verbose = verbose_opt (env, ' --verbose')
+a = ('(cd ${TARGET.dir} && '
+ + ' if test -e ${SOURCE.filebase}.enc; then encoding="--encoding=${SOURCE.filebase}.enc"; fi;' \
+# + ' MFINPUTS=.:${TARGET.dir}:${SOURCE.dir}'\
+# ugrh
+ + ' MFINPUTS=%(srcdir)s/mf}:.:'\
+ + ' mftrace --pfa --simplify --keep-trying $$encoding%(verbose)s'\
+ + ' --include=${TARGET.dir}'\
+ + ' ${SOURCE.file})') % vars ()
+
+pfa = Builder (action = a,
suffix = '.pfa',
src_suffix = '.mf',
emitter = add_enc_src)
-verbose = verbose_opt (env, ' --verbose')
def run_mftrace (target, source, env):
TARGET = target[0]
SOURCE = source[0]
mf = os.path.basename (str (source[0]))
base = os.path.splitext (os.path.basename (str (target[0])))[0]
enc = base + '.enc'
- mfdir = os.path.join (here, reldir)
- outdir = os.path.join (env['build'], reldir, env['out'])
encoding = encoding_opt (target)
- command = ('(cd ${TARGET.dir} && '
- + ' MFINPUTS=.:${TARGET.dir}:' + mfdir\
+ verbose = verbose_opt (env, ' --verbose')
+ command = ('(cd $$(dirname %(TARGET)s && '
+ + ' MFINPUTS=.:$$(dirname %(TARGET)s):$$(dirname %(SOURCE)s'\
+ ' mftrace --pfa --simplify --keep-trying%(verbose)s'\
+ ' --include=${TARGET.dir}'\
+ ' %(encoding)s %(mf)s)') % vars ()
return os.system (command)
-pfa = Builder (action = run_mftrace, suffix = '.pfa', src_suffix = '.mf',
+xpfa = Builder (action = run_mftrace, suffix = '.pfa', src_suffix = '.mf',
emitter = add_enc_src)
env.Append (BUILDERS = {'PFA': pfa})