From: David Kastrup <dak@gnu.org>
Date: Sat, 22 Feb 2014 19:54:11 +0000 (+0100)
Subject: Issue 3874: lilypond-book: Fix TEXINPUTS environment manipulation on W32
X-Git-Tag: release/2.18.2-1~3
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=766d34770ee974588fcc9d9fbd8122c7a9112ebc;p=lilypond.git

Issue 3874: lilypond-book: Fix TEXINPUTS environment manipulation on W32

(cherry picked from commit aa89d7b8d687e42cdbf11b14dc8e0b4827a8aa9e)
---

diff --git a/python/book_latex.py b/python/book_latex.py
index 5f062c5375..a3b2b18b78 100644
--- a/python/book_latex.py
+++ b/python/book_latex.py
@@ -189,11 +189,12 @@ def get_latex_textwidth (source, global_options):
 
     progress (_ ("Running `%s' on file `%s' to detect default page settings.\n")
               % (global_options.latex_program, tmpfile))
-    cmd = 'TEXINPUTS="%s:$TEXINPUTS" %s %s' \
-        % (global_options.input_dir, global_options.latex_program, tmpfile)
+    cmd = '%s %s' % (global_options.latex_program, tmpfile)
     debug ("Executing: %s\n" % cmd)
     run_env = os.environ.copy()
     run_env['LC_ALL'] = 'C'
+    run_env['TEXINPUTS'] = '%s:%s' % \
+                           (global_options.input_dir, run_env.get('TEXINPUTS',""))
 
     ### unknown why this is necessary
     universal_newlines = True