]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scripts/lilypond-book.py (do_file): search for kpsewhich before
authorhanwen <hanwen>
Wed, 29 Jun 2005 22:01:45 +0000 (22:01 +0000)
committerhanwen <hanwen>
Wed, 29 Jun 2005 22:01:45 +0000 (22:01 +0000)
invoking.

* python/lilylib.py (search_exe_path): new function.

ChangeLog
python/lilylib.py
scm/define-markup-commands.scm
scripts/lilypond-book.py

index b5f8dd4183abcff4ad0fa5962b9481ae05542941..5d04a16feced686a948b58663d9cf479c6a2a5cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
+2005-06-30  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * 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  <hanwen@xs4all.nl>
 
+       * python/lilylib.py (mkdir_p): remove setup_environment()
+       (backportme)
+
        * buildscripts/mutopia-index.py (headertext): trim text.
 
        * Documentation/topdocs/NEWS.tely (Top): refresh.
index 934b1eebf4b96c002d4b3e747a60da53074021e5..e56fa6d9d76963c57fe54b44eef722f5812442f8 100644 (file)
@@ -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 ():
index bf2c40c869967db79a242e5996d2e82b3eb81d49..d2b1aaa0b6a982a872b3416e006b05e8a0eeae61 100644 (file)
@@ -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))
index 20d6b11410e33a36ab246d40d04265cfa944a37a..ccc873c41c36e8b5556ed93bda1972b6a9ffe03b 100644 (file)
@@ -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)