X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=python%2Fbook_latex.py;h=ec5412b1d8192bee41e292e31bc62a78798cc45d;hb=8c1840ca28a05b3dad8d595e04d03779ba0a286a;hp=5f062c537525b729428f99e209d4b41fa0d929d6;hpb=1f2bdee043a85ddca79be8ef99b206fb3a97b289;p=lilypond.git diff --git a/python/book_latex.py b/python/book_latex.py index 5f062c5375..ec5412b1d8 100644 --- a/python/book_latex.py +++ b/python/book_latex.py @@ -189,17 +189,17 @@ 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 if sys.platform == 'mingw32': universal_newlines = False - if (sys.platform == 'mingw32') and (sys.version_info < (2, 6)): ### use os.system to avoid weird sleep() problems on ### GUB's python 2.4.2 on mingw # make file to write to @@ -207,7 +207,13 @@ def get_latex_textwidth (source, global_options): output_filename = os.path.join(output_dir, 'output.txt') # call command cmd += " > %s" % output_filename + oldtexinputs = os.environ.get ('TEXINPUTS') + os.environ['TEXINPUTS'] = run_env['TEXINPUTS'] returncode = os.system(cmd) + if oldtexinputs: + os.environ['TEXINPUTS'] = oldtexinputs + else: + del os.environ['TEXINPUTS'] parameter_string = open(output_filename).read() if returncode != 0: warning (_ ("Unable to auto-detect default settings:\n"))