]> git.donarmstrong.com Git - lilypond.git/commitdiff
bib2html: set TEXMFOUTPUT to the tempdir.
authorPatrick McCarty <pnorcks@gmail.com>
Tue, 2 Feb 2010 21:33:44 +0000 (13:33 -0800)
committerGraham Percival <graham@percival-music.ca>
Thu, 4 Feb 2010 15:25:16 +0000 (15:25 +0000)
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

index c16f21cce28c9b91512bf08cf6393172bb96036a..8434cbfb54d04c4423406cfeb83fc6810efdf289 100644 (file)
@@ -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)