From 4d45518a9e5e39d06ba02ecee67ce19e19528463 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 10 Jul 2004 11:19:40 +0000 Subject: [PATCH] * mf/SConscript: Remove Builders. * buildscripts/builder.py: Add LilyPond, Abc2ly and MF builders. * input/SConscript: * Documentation/user/SConscript: New file. --- ChangeLog | 9 +++ Documentation/SConscript | 111 +++++------------------------ Documentation/user/SConscript | 99 ++++++++++++++++++++++++++ SConstruct | 13 +++- buildscripts/builder.py | 127 +++++++++++++++++++++++++++++++--- input/SConscript | 40 +++++++++++ mf/SConscript | 93 ++----------------------- 7 files changed, 298 insertions(+), 194 deletions(-) create mode 100644 Documentation/user/SConscript create mode 100644 input/SConscript diff --git a/ChangeLog b/ChangeLog index b8a93af408..fb8168a310 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-07-10 Jan Nieuwenhuizen + + * mf/SConscript: Remove Builders. + + * buildscripts/builder.py: Add LilyPond, Abc2ly and MF builders. + + * input/SConscript: + * Documentation/user/SConscript: New file. + 2004-07-10 Han-Wen Nienhuys * Documentation/topdocs/NEWS.texi (Top): add note about new diff --git a/Documentation/SConscript b/Documentation/SConscript index b9e26349c6..2d43c4fd23 100644 --- a/Documentation/SConscript +++ b/Documentation/SConscript @@ -6,104 +6,27 @@ import os here = os.getcwd () reldir = str (Dir ('.').srcnode ()) os.chdir (reldir) -###sources = glob.glob ('*.tely') + glob.glob ('user/*.tely') -sources = ['user/lilypond.tely', 'user/music-glossary.tely'] -pngs = glob.glob ('user/*.png') +sources = ['index.html.in', 'texinfo.css'] os.chdir (here) Import ('env') -e = env.Copy () -outdir = os.path.join (env['build'], reldir, env['out']) -# Too late -e.Append (LILYPOND_BOOK_PATH = [os.path.join (env['srcdir'], reldir, 'user')]) -e['LILYPOND_BOOK_PATH'].append (os.path.join (env['srcdir'], reldir, 'user')) - - - -def verbose_opt (env, opt): - if env['verbose']: - return opt - return '' - -LILYPOND_BIN = env['LILYPOND_BIN'] -LILYPONDPREFIX = env['LILYPONDPREFIX'] - - -mfbuild = os.path.join (env['absbuild'], 'mf', env['out']) -lilybuild = os.path.join (env['absbuild'], 'lily', env['out']) -userbuild = os.path.join (env['absbuild'], 'Documentation/user', env['out']) -e.Depends ('user/lilypond.texi', os.path.join (mfbuild, 'feta16list.ly')) -e.Depends ('user/lilypond.texi', os.path.join (mfbuild, 'parmesan16list.ly')) -e.Depends ('lilypond.texi', 'lilypond-internals.texi') -e.Depends ('lilypond.texi', os.path.join (lilybuild, 'lilypond-bin')) - -png_stems = map (lambda x: os.path.splitext (x)[0], pngs) -epss = map (e.Png2eps, png_stems) -e.Depends ('lilypond.texi', epss) - -e.Command ('lilypond-internals.texi', LILYPOND_BIN, - ('(cd $$(dirname $TARGET) && \ - LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \ - + verbose_opt (env, ' --verbose') \ - + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\ - + ')') % vars ()) - -doc_stems = map (lambda x: os.path.splitext (x)[0], sources) -texis = map (e.Tely2texi, doc_stems) -dvis = map (e.Texi2dvi, doc_stems) -pss = map (e.PostScript, map (lambda x: x + '.dvi', doc_stems)) -pdfs = map (e.Dvi2pdf, doc_stems) - -docdir = os.path.join (env['srcdir'], 'Documentation') -out = env['out'] -# TODO: purl (ugh?), symlinks -a = ('makeinfo -I$$(dirname $SOURCE) \ ---output=%(out)s/lilypond \ ---css-include=%(docdir)s/texinfo.css \ ---html' \ - + verbose_opt (env, ' --verbose') \ - + ' $SOURCE && \ - makeinfo -I$$(dirname $SOURCE) \ - --output=$TARGET \ - --css-include=%(docdir)s/texinfo.css \ - --html --no-split --no-headers' \ - + verbose_opt (env, ' --verbose') \ - + ' $SOURCE') % vars () -#e.Command ('lilypond/lilypond.html', -# 'lilypond.texi', -e.Command ('user/lilypond/lilypond.html', - 'user/lilypond.texi', -# os.path.join (userbuild, 'lilypond.texi'), - a) - -# TODO: purl (ugh?), symlinks -a = ('makeinfo -I$$(dirname $SOURCE) \ ---output=%(out)s/lilypond-internals \ ---css-include=%(docdir)s/texinfo.css \ ---html' \ - + verbose_opt (env, ' --verbose') \ - + ' $SOURCE && \ - makeinfo -I$$(dirname $SOURCE) \ - --output=$TARGET \ - --css-include=%(docdir)s/texinfo.css \ - --html --no-split --no-headers' \ - + verbose_opt (env, ' --verbose') \ - + ' $SOURCE') % vars () -#e.Command ('lilypond-internals/lilypond-internals.html', -# 'lilypond-internals.texi', -e.Command ('user/lilypond-internals/lilypond-internals.html', - 'user/lilypond-internals.texi', -# os.path.join (userbuild, 'lilypond-internals.texi'), - a) - -e.Alias ('doc', texis) -e.Alias ('doc', dvis) -e.Alias ('doc', pss) -e.Alias ('doc', pdfs) - -#e.Alias ('doc', 'user/lilypond-internals/lilypond.html') -#e.Alias ('doc', 'user/lilypond-internals/lilypond-internals.html') +#SConscript (os.path.join (b, 'SConscript')) + +# build = env['build'] +# out = env['out'] + +# subdirs = ['user',] +# for d in subdirs: +# b = os.path.join (build, d, out) +# # Support clean sourctree build (srcdir build) +# # and outdir build. +# # TODO: figure out SConscript (dir, builddir, duplicate)) feature +# if (build and build != '.') \ +# or (out and out != '.'): +# env.BuildDir (b, d, duplicate=0) +# SConscript (os.path.join (b, 'SConscript')) +#SConscript (os.path.join ('user', 'SConscript')) #testing all_sources = ['SConscript',] + sources diff --git a/Documentation/user/SConscript b/Documentation/user/SConscript new file mode 100644 index 0000000000..f41eae4982 --- /dev/null +++ b/Documentation/user/SConscript @@ -0,0 +1,99 @@ +# -*-python-*- + +import glob +import os + +here = os.getcwd () +reldir = str (Dir ('.').srcnode ()) +os.chdir (reldir) +sources = glob.glob ('*.tely') +pngs = glob.glob ('*.png') +os.chdir (here) + +Import ('env') +e = env.Copy () +outdir = os.path.join (env['build'], reldir, env['out']) + +# Too late +e.Append (LILYPOND_BOOK_PATH = [os.path.join (env['srcdir'], reldir, 'user')]) +e['LILYPOND_BOOK_PATH'].append (os.path.join (env['srcdir'], reldir, 'user')) + +def verbose_opt (env, opt): + if env['verbose']: + return opt + return '' + +LILYPOND_BIN = env['LILYPOND_BIN'] +LILYPONDPREFIX = env['LILYPONDPREFIX'] + +mfbuild = os.path.join (env['absbuild'], 'mf', env['out']) +lilybuild = os.path.join (env['absbuild'], 'lily', env['out']) +userbuild = os.path.join (env['absbuild'], 'Documentation/user', env['out']) +e.Depends ('lilypond.texi', os.path.join (mfbuild, 'feta16list.ly')) +e.Depends ('lilypond.texi', os.path.join (mfbuild, 'parmesan16list.ly')) +e.Depends ('lilypond.texi', LILYPOND_BIN) +e.Depends ('lilypond.texi', 'lilypond-internals.texi') +#e.Depends ('lilypond.texi', os.path.join (lilybuild, 'lilypond-bin')) + +png_stems = map (lambda x: os.path.splitext (x)[0], pngs) +epss = map (e.Png2eps, png_stems) +e.Depends ('lilypond.texi', epss) + +e.Command ('lilypond-internals.texi', LILYPOND_BIN, + ('(cd $$(dirname $TARGET) && \ + LILYPONDPREFIX=%(LILYPONDPREFIX)s %(LILYPOND_BIN)s ' \ + + verbose_opt (env, ' --verbose') \ + + ' ' + os.path.join (env['srcdir'], 'ly/generate-documentation')\ + + ')') % vars ()) + +doc_stems = map (lambda x: os.path.splitext (x)[0], sources) +texis = map (e.Tely2texi, doc_stems) +dvis = map (e.Texi2dvi, doc_stems) +pss = map (e.PostScript, map (lambda x: x + '.dvi', doc_stems)) +pdfs = map (e.Dvi2pdf, doc_stems) + +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%(srcdir)s/%(reldir)s -I$$(dirname $SOURCE)'\ + + ' --output=%(out)s/lilypond'\ + + ' --css-include=%(docdir)s/texinfo.css'\ + + ' --html%(verbose)s'\ + + ' $SOURCE &&' \ + + ' makeinfo -I%(srcdir)s/%(reldir)s -I$$(dirname $SOURCE)' \ + + ' --output=$TARGET' \ + + ' --css-include=%(docdir)s/texinfo.css' \ + + ' --html --no-split --no-headers %(verbose)s' \ + + ' $SOURCE') % vars () +e.Command ('lilypond/lilypond.html', 'lilypond.texi', a) + +# TODO: purl (ugh?), symlinks +a = ('makeinfo -I%(srcdir)s/%(reldir)s -I$$(dirname $SOURCE)'\ + + ' --output=%(out)s/lilypond-internals' \ + + ' --css-include=%(docdir)s/texinfo.css' \ + + ' --html%(verbose)s'\ + + ' $SOURCE &&' \ + + ' makeinfo -I%(srcdir)s/%(reldir)s -I$$(dirname $SOURCE)' \ + + ' --output=$TARGET' \ + + ' --css-include=%(docdir)s/texinfo.css' \ + + ' --html --no-split --no-headers %(verbose)s' \ + + ' $SOURCE') % vars () +e.Command ('lilypond-internals/lilypond-internals.html', + 'lilypond-internals.texi', + a) + +e.Alias ('doc', texis) +e.Alias ('doc', dvis) +e.Alias ('doc', pss) +e.Alias ('doc', pdfs) + +e.Alias ('doc', 'lilypond-internals/lilypond.html') +e.Alias ('doc', 'lilypond-internals/lilypond-internals.html') + +#testing +all_sources = ['SConscript',] + sources + pngs +x = env.Tar (env['tarball'], all_sources) diff --git a/SConstruct b/SConstruct index a29592389d..1a3e000eaf 100644 --- a/SConstruct +++ b/SConstruct @@ -333,16 +333,22 @@ env['PYTHON'] = 'python' env['LILYPOND_BIN'] = os.path.join (absbuild, 'lily', out, 'lilypond-bin') env['LILYPONDPREFIX'] = os.path.join (outdir, 'usr/share/lilypond') env['LILYPOND_BOOK'] = srcdir + '/scripts/lilypond-book.py' +env['ABC2LY_PY'] = srcdir + '/scripts/abc2ly.py' +env['MF_TO_TABLE_PY'] = srcdir + '/buildscripts/mf-to-table.py' +env['LILYPOND_PY'] = srcdir + '/scripts/lilypond.py' env['LILYPOND_BOOK_FLAGS'] = '' env['LILYPOND_BOOK_FORMAT'] = 'texi-html' +# ugh? env['LILYPOND_BOOK_PATH'] = ['.', '#/input', '#/input/regression', '#/input/test', '#/input/tutorial', os.path.join (absbuild, 'mf', out), '#/Documentation/user', - os.path.join (absbuild, 'Documentation', out)] + os.path.join (absbuild, 'Documentation', out), + os.path.join (absbuild, 'Documentation/user', out), + ] env['MAKEINFO_PATH'] = ['.', '#/Documentation/user', - os.path.join (absbuild, 'Documentation', out)] + os.path.join (absbuild, 'Documentation/user', out)] ## TEXINFO_PAPERSIZE_OPTION= $(if $(findstring $(PAPERSIZE),a4),,-t @afourpaper) env['TEXINFO_PAPERSIZE_OPTION'] = '-t @afourpaper' @@ -352,7 +358,8 @@ SConscript ('buildscripts/builder.py') #subdirs = ['mf',] #subdirs = ['flower', 'lily', 'parser', 'gui', 'main',] #subdirs = ['flower', 'lily', 'mf', 'scm', 'ly'] -subdirs = ['flower', 'lily', 'mf', 'scm', 'ly', 'Documentation'] +subdirs = ['flower', 'lily', 'mf', 'scm', 'ly', 'Documentation', + 'Documentation/user', 'input'] for d in subdirs: b = os.path.join (build, d, out) # Support clean sourctree build (srcdir build) diff --git a/buildscripts/builder.py b/buildscripts/builder.py index b614e9d1a5..d9107fc364 100644 --- a/buildscripts/builder.py +++ b/buildscripts/builder.py @@ -19,17 +19,18 @@ def join_path (path, infix=os.pathsep, prefix = ''): return x return string.join (map (lambda x: prefix + dir (x), path), infix) +verbose = verbose_opt (env, ' --verbose') MAKEINFO_INCLUDES = join_path (env['MAKEINFO_PATH'], '', ' -I') -a = env['MAKEINFO'] + verbose_opt (env, ' --verbose') \ - + MAKEINFO_INCLUDES \ - + ' --no-split --no-headers --output=$TARGET $SOURCE' - +MAKEINFO = env['MAKEINFO'] +a = ('%(MAKEINFO)s %(verbose)s %(MAKEINFO_INCLUDES)s'\ + ' --no-split --no-headers --output=$TARGET $SOURCE') % vars () texi2txt = Builder (action = a, suffix = '.txt', src_suffix = '.texi') - env.Append (BUILDERS = {'Texi2txt': texi2txt}) PYTHON = env['PYTHON'] +ABC2LY_PY = env['ABC2LY_PY'] +LILYPOND_PY = env['LILYPOND_PY'] LILYPOND_BIN = env['LILYPOND_BIN'] LILYPOND_BOOK = env['LILYPOND_BOOK'] LILYPOND_BOOK_FLAGS = env['LILYPOND_BOOK_FLAGS'] @@ -49,11 +50,10 @@ if os.environ.has_key ('TEXMF'): env.Append (ENV = {'TEXMF' : '{' + LILYPONDPREFIX + ',' \ + os.popen ('kpsexpand \$TEXMF').read ()[:-1] + '}' }) -## + ' --output=$$(basename $TARGET) --format=%(LILYPOND_BOOK_FORMAT)s\ -##a = (r'''echo "NOT RM $$(grep -LF '\lilypondend' $$(dirname $TARGET)/lily-*.tex)"; ''' \ +verbose = verbose_opt (env, ' --verbose') a = (r'''rm -f $$(grep -LF '\lilypondend' $$(dirname $TARGET)/lily-*.tex 2>/dev/null); ''' \ + 'LILYPONDPREFIX=%(LILYPONDPREFIX)s '\ - + PYTHON + ' ' + LILYPOND_BOOK + verbose_opt (env, ' --verbose')\ + + '%(PYTHON)s %(LILYPOND_BOOK)s%(verbose)s'\ + ' --include=$$(dirname $TARGET) %(LILYPOND_BOOK_INCLUDES)s'\ + r""" --process='%(LILYPOND_BIN)s %(LILYPOND_BOOK_INCLUDES)s'"""\ + ' --output=$$(dirname $TARGET) --format=%(LILYPOND_BOOK_FORMAT)s\ @@ -83,3 +83,114 @@ env.Append (BUILDERS = {'Dvi2pdf': dvi2pdf}) a = 'convert $SOURCE $TARGET' png2eps = Builder (action = a, suffix = '.eps', src_suffix = '.png') env.Append (BUILDERS = {'Png2eps': png2eps}) + +def add_ps_target (target, source, env): + base = os.path.splitext (str (target[0]))[0] + return (target + [base + '.ps'], source) + +a = ('LILYPONDPREFIX=%(LILYPONDPREFIX)s '\ + + PYTHON + ' ' + LILYPOND_PY + verbose_opt (env, ' --verbose')\ + + ' --include=$$(dirname $TARGET)'\ + + ' --output=$$(dirname $TARGET)'\ + + ' $SOURCE') % vars () +lilypond = Builder (action = a, suffix = '.pdf', src_suffix = '.ly') +## emitter = add_ps_target) +env.Append (BUILDERS = {'LilyPond': lilypond}) + +verbose = verbose_opt (env, ' --verbose') +a = ('LILYPONDPREFIX=%(LILYPONDPREFIX)s '\ + + '%(PYTHON)s %(ABC2LY_PY)s%(verbose)s'\ + + ' --include=$$(dirname $TARGET)'\ + + ' --output=$$(dirname $TARGET)'\ + + ' $SOURCE') % vars () +abc2ly = Builder (action = a, suffix = '.ly', src_suffix = '.abc') +env.Append (BUILDERS = {'Abc2ly': abc2ly}) + + +MFMODE = env['MFMODE'] +def add_log_target (target, source, env): + base = os.path.splitext (str (target[0]))[0] + return (target + [base + '.log'], source) + +def add_enc_ly_tex_target (target, source, env): + base = os.path.splitext (str (target[0]))[0] + return (target + [base + '.enc', base + '.tex', base + 'list.ly'], + source) + +def add_suffixes (target, source, env, target_suffixes, src_suffixes): + base = os.path.splitext (str (target[0]))[0] + return (target + map (lambda x: base + x, target_suffixes), + source + map (lambda x: base + x, src_suffixes)) + +#outdir = os.path.join (env['build'], reldir, env['out']) +outdir = '$$(dirname $TARGET)' +scrdir = env['srcdir'] +#MFINPUTS = '.:' + str (Dir ('#/mf')) +#MFINPUTS = '.:$$(dirname $SOURCE)' +a = ('(cd $$(dirname $TARGET) &&'\ +# + ' MFINPUTS=.:$$(dirname $SOURCE)'\ + + ' MFINPUTS=.:$$(dirname $SOURCE):%(srcdir)s/$$(dirname $SOURCE)'\ + + ' mf "\\mode:=%(MFMODE)s; nonstopmode;'\ + + ' input $$(basename $SOURCE);" ' \ + + ' | grep -v "@\|>>")') % vars () +tfm = Builder (action = a, suffix = '.tfm', src_suffix = '.mf', +# emitter = lambda t, s, e: add_suffixes (t, s, e, ['.log'], [])) + emitter = add_log_target) +env.Append (BUILDERS = {'TFM': tfm}) + +MF_TO_TABLE_PY = env['MF_TO_TABLE_PY'] +verbose = verbose_opt (env, ' --verbose') +a = ('%(PYTHON)s %(MF_TO_TABLE_PY)s%(verbose)s'\ + + ' --outdir=$$(dirname $TARGET)'\ + + ' --afm=%(outdir)s/$$(basename $TARGET .afm).afm' \ + + ' --enc=%(outdir)s/$$(basename $TARGET .afm).enc' \ + + ' --tex=%(outdir)s/$$(basename $TARGET .afm).tex' \ + + ' --ly=%(outdir)s/$$(basename $TARGET .afm)list.ly'\ + + ' $$(dirname $TARGET)/$$(basename $SOURCE)') % vars () +afm = Builder (action = a, suffix = '.afm', src_suffix = '.log', + emitter = add_enc_ly_tex_target) +env.Append (BUILDERS = {'AFM': afm}) + +def add_enc_src (target, source, env): + base = os.path.splitext (str (target[0]))[0] + return (target, source + [base + '.enc']) + +def encoding_opt (target): + base = os.path.splitext (os.path.basename (str (target[0])))[0] + enc = base + '.enc' + if os.path.exists (os.path.join (outdir, enc)): + return ' --encoding=' + enc + return '' + +# UGH, should fix --output option for mftrace +xpfa = Builder (action = ('MFINPUTS=.:' + str (Dir ('#/mf')) \ + + ' mftrace -I %(outdir)s --pfa' \ + + ' --simplify --keep-trying' \ + + ' $$(basename $SOURCE .mf) ' \ + + ' && mv $$(basename $TARGET) $TARGET') % vars (), + 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 $$(dirname $TARGET) && ' + + ' MFINPUTS=.:$$(dirname $TARGET):' + mfdir\ + + ' mftrace --pfa --simplify --keep-trying %(verbose)s' \ + + ' --include=$$(dirname $TARGET)'\ + + ' %(encoding)s %(mf)s)') % vars () + return os.system (command) + +pfa = Builder (action = run_mftrace, suffix = '.pfa', src_suffix = '.mf', + emitter = add_enc_src) +env.Append (BUILDERS = {'PFA': pfa}) + + diff --git a/input/SConscript b/input/SConscript new file mode 100644 index 0000000000..6df0a1a43b --- /dev/null +++ b/input/SConscript @@ -0,0 +1,40 @@ +# -*-python-*- + +import glob +import os + +here = os.getcwd () +reldir = str (Dir ('.').srcnode ()) +os.chdir (reldir) +sources = glob.glob ('*.ly') +abc_sources = glob.glob ('*.abc') +os.chdir (here) + +Import ('env') +e = env.Copy () +#outdir = os.path.join (env['build'], reldir, env['out']) + +# examples = simple simple-song les-nereides puer-fragment wilhelmus paddy + +stems = map (lambda x: os.path.splitext (x)[0], sources) +pdfs = map (e.LilyPond, stems) + +abc_stems = map (lambda x: os.path.splitext (x)[0], abc_sources) +lys = map (e.Abc2ly, abc_stems) +pdfs = pdfs + map (e.LilyPond, lys) + +LILYPOND_BIN = env['LILYPOND_BIN'] + +#e.Depends (pdfs, LILYPOND_BIN) +# e.Depends (pdfs, 'lilypond-internals.texi') + +mfbuild = os.path.join (env['absbuild'], 'mf', env['out']) +e.Depends ('doc', mfbuild) +e.Depends ('doc', LILYPOND_BIN) +#e.Depends (doc, 'lilypond-internals.texi') + +e.Alias ('doc', pdfs) + +#testing +all_sources = ['SConscript',] + sources + abc_sources +x = env.Tar (env['tarball'], all_sources) diff --git a/mf/SConscript b/mf/SConscript index 6f871d9cb7..572e64d66a 100644 --- a/mf/SConscript +++ b/mf/SConscript @@ -20,99 +20,14 @@ mf_sources = reduce (lambda x, y: x + y, os.chdir (here) Import ('env') -MFMODE = env['MFMODE'] -def add_log_target (target, source, env): - base = os.path.splitext (str (target[0]))[0] - return (target + [base + '.log'], source) - -def add_enc_ly_tex_target (target, source, env): - base = os.path.splitext (str (target[0]))[0] - return (target + [base + '.enc', base + '.tex', base + 'list.ly'] - , source) - -outdir = os.path.join (env['build'], reldir, env['out']) -tfm = Builder (action = ('(cd ' + outdir + ' && ' \ - + 'MFINPUTS=.:' + str (Dir ('#/mf')) \ - + ' mf "\\mode:=%(MFMODE)s; nonstopmode; ' \ - + ' input $$(basename $SOURCE);" ' \ - + ' | grep -v "@\|>>")') % vars (), - suffix = '.tfm', - src_suffix = '.mf', - emitter = add_log_target) - -afm = Builder (action = (sys.executable \ - + ' buildscripts/mf-to-table.py ' \ - + ' --outdir=%(outdir)s '\ - + ' --afm=%(outdir)s/$$(basename $TARGET .afm).afm' \ - + ' --enc=%(outdir)s/$$(basename $TARGET .afm).enc' \ - + ' --tex=%(outdir)s/$$(basename $TARGET .afm).tex' \ - + ' --ly=%(outdir)s/$$(basename $TARGET .afm)list.ly'\ - + ' %(outdir)s/$$(basename $SOURCE)') % vars (), - suffix = '.afm', - src_suffix = '.log', - emitter = add_enc_ly_tex_target) - -def add_enc_src (target, source, env): - base = os.path.splitext (str (target[0]))[0] - return (target, source + [base + '.enc']) - -def encoding_opt (target): - base = os.path.splitext (os.path.basename (str (target[0])))[0] - ##enc = os.path.join (outdir, base + '.enc') - enc = base + '.enc' - if os.path.exists (os.path.join (outdir, enc)): - return ' --encoding=' + enc - return '' - -def verbose_opt (env, opt): - if env['verbose']: - return opt - return '' - -# UGH, should fix --output option for mftrace -xpfa = Builder (action = ('MFINPUTS=.:' + str (Dir ('#/mf')) \ - + ' mftrace -I %(outdir)s --pfa' \ - + ' --simplify --keep-trying' \ - + ' $$(basename $SOURCE .mf) ' \ - + ' && mv $$(basename $TARGET) $TARGET') % vars (), - suffix = '.pfa', - src_suffix = '.mf', - emitter = add_enc_src) - -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']) - command = ('(cd %(outdir)s && ' - + ' MFINPUTS=.:%(outdir)s:' + mfdir\ - + ' mftrace --pfa --simplify --keep-trying' \ - + ' --include=%(outdir)s'\ - + verbose_opt (env, ' --verbose') \ - + encoding_opt (target) \ - + ' %(mf)s)') % vars () - return os.system (command) - -pfa = Builder (action = run_mftrace, - suffix = '.pfa', - src_suffix = '.mf', - emitter = add_enc_src) - - -e = env.Copy (BUILDERS = {'Tfm' : tfm, - 'Afm' : afm, 'Pfa' : pfa}, - MFINPUTS = '#/mf') - +e = env.Copy () #mf_sources = ('feta16.mf',) #mf_sources = ('feta-braces-a.mf',) font_stems = map (lambda x: os.path.splitext (x)[0], mf_sources) -t = map (e.Tfm, font_stems) -a = map (e.Afm, font_stems) -p = map (e.Pfa, font_stems) +t = map (e.TFM, font_stems) +a = map (e.AFM, font_stems) +p = map (e.PFA, font_stems) map (lambda x: e.Depends (x + '.pfa', x + '.enc'), font_stems) #map (lambda x: e.Depends (x + '.pfa', x + '.log'), font_stems) -- 2.39.2