From 2d6b974a040adafd06b05052cb1d1714f1e8c7fb Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 29 Jun 2005 22:01:45 +0000 Subject: [PATCH] * scripts/lilypond-book.py (do_file): search for kpsewhich before invoking. * python/lilylib.py (search_exe_path): new function. --- ChangeLog | 10 ++++++ python/lilylib.py | 56 +++++++--------------------------- scm/define-markup-commands.scm | 2 +- scripts/lilypond-book.py | 3 +- 4 files changed, 23 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5f8dd4183..5d04a16fec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ +2005-06-30 Han-Wen Nienhuys + + * scripts/lilypond-book.py (do_file): search for kpsewhich before + invoking. + + * python/lilylib.py (search_exe_path): new function. + 2005-06-29 Han-Wen Nienhuys + * python/lilylib.py (mkdir_p): remove setup_environment() + (backportme) + * buildscripts/mutopia-index.py (headertext): trim text. * Documentation/topdocs/NEWS.tely (Top): refresh. diff --git a/python/lilylib.py b/python/lilylib.py index 934b1eebf4..e56fa6d9d7 100644 --- a/python/lilylib.py +++ b/python/lilylib.py @@ -400,54 +400,20 @@ else: system ('mkdir -p %s' % dir) -def mkdir_p (dir, mode=0777): - if not os.path.isdir (dir): - makedirs (dir, mode) +def search_exe_path (name): + p = os.environ['PATH'] + exe_paths = string.split (p, ':') + for e in exe_paths: + full = os.path.join (e, name) + if os.path.exists (full): + return full + return None -environment = {} -# tex needs lots of memory, more than it gets by default on Debian -non_path_environment = { - 'extra_mem_top' : '1000000', - 'extra_mem_bottom' : '1000000', - 'pool_size' : '250000', -} - -def setup_environment (): - global environment - - kpse = read_pipe ('kpsexpand \$TEXMF') - texmf = re.sub ('[ \t\n]+$','', kpse) - type1_paths = read_pipe ('kpsewhich -expand-path=\$T1FONTS') - - environment = { - # TODO: * prevent multiple addition. - # * clean TEXINPUTS, MFINPUTS, TFMFONTS, - # as these take prevalence over $TEXMF - # and thus may break tex run? - - 'TEXMF' : "{%s,%s}" % (datadir, texmf) , - - # 'GS_FONTPATH' : type1_paths, - # 'GS_LIB' : datadir + '/ps', - 'GS_FONTPATH' : "", - 'GS_LIB' : "", - } - - # $TEXMF is special, previous value is already taken care of - if os.environ.has_key ('TEXMF'): - del os.environ['TEXMF'] - - for key in environment.keys (): - val = environment[key] - if os.environ.has_key (key): - val = os.environ[key] + os.pathsep + val - os.environ[key] = val - - for key in non_path_environment.keys (): - val = non_path_environment[key] - os.environ[key] = val +def mkdir_p (dir, mode=0777): + if not os.path.isdir (dir): + makedirs (dir, mode) def print_environment (): for (k,v) in os.environ.items (): diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index bf2c40c869..d2b1aaa0b6 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -463,7 +463,7 @@ determines the space between each markup in @var{args}." (wordwrap-markups layout props args #f)) -(define (wordwrap-string layout props justify arg) +(define (wordwrap-string layout props justify arg) (let* ((baseline-skip (chain-assoc-get 'baseline-skip props)) (line-width (chain-assoc-get 'linewidth props)) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index 20d6b11410..ccc873c41c 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -1409,7 +1409,7 @@ def do_file (input_filename): else: if os.path.exists (input_filename): input_fullname = input_filename - elif format == LATEX: + elif format == LATEX and ly.search_exe_path ('kpsewhich'): # urg python interface to libkpathsea? input_fullname = ly.read_pipe ('kpsewhich ' + input_filename)[:-1] @@ -1577,7 +1577,6 @@ def main (): for p in include_path]) ly.identify (sys.stderr) - ly.setup_environment () try: chunks = do_file (file) -- 2.39.5