From da009bcd6532ed1564440ddff73a1a92019d5420 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Tue, 2 Feb 2010 13:33:44 -0800 Subject: [PATCH] bib2html: set TEXMFOUTPUT to the tempdir. With the latest update of TeX Live 2009, bibtex became a "safe" command in that it cannot write output to any directory other than (a) a subdirectory of the current directory (b) a subdirectory of TEXMFOUTPUT Setting TEXMFOUTPUT to the temporary directory permits bibtex to write in that directory. Additionally, use mkstemp() instead mktemp(), since the latter function has been deprecated since Python 2.3. --- scripts/build/bib2html.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/build/bib2html.py b/scripts/build/bib2html.py index c16f21cce2..8434cbfb54 100644 --- a/scripts/build/bib2html.py +++ b/scripts/build/bib2html.py @@ -28,8 +28,6 @@ for (o,a) in options: if style not in ['alpha','index','long','longp','long-pario','short','short-pario','split']: sys.stderr.write ("Unknown style \`%s'\n" % style) -tempfile = tempfile.mktemp ('bib2html') - if not files: usage () sys.exit (2) @@ -47,13 +45,17 @@ for f in files: files = ','.join (nf) -open (tempfile + '.aux', 'w').write (r''' +tmpfile = tempfile.mkstemp ('bib2html')[1] + +open (tmpfile + '.aux', 'w').write (r''' \relax \citation{*} \bibstyle{html-%(style)s} \bibdata{%(files)s}''' % vars ()) -cmd = "bibtex %s" % tempfile +tmpdir = tempfile.gettempdir () + +cmd = "TEXMFOUTPUT=%s bibtex %s" % (tmpdir, tmpfile) sys.stdout.write ("Invoking `%s'\n" % cmd) stat = os.system (cmd) @@ -63,14 +65,14 @@ if stat <> 0: #TODO: do tex -> html on output -bbl = open (tempfile + '.bbl').read () +bbl = open (tmpfile + '.bbl').read () open (output, 'w').write (bbl) -def cleanup (tempfile): +def cleanup (tmpfile): for a in ['aux','bbl', 'blg']: - os.unlink (tempfile + '.' + a) + os.unlink (tmpfile + '.' + a) -cleanup (tempfile) +cleanup (tmpfile) -- 2.39.5