From: Patrick McCarty Date: Tue, 2 Feb 2010 21:33:44 +0000 (-0800) Subject: bib2html: set TEXMFOUTPUT to the tempdir. X-Git-Tag: release/2.13.12-1^2~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=da009bcd6532ed1564440ddff73a1a92019d5420;p=lilypond.git 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. --- 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)