Hi,

I need this patch for the latest updates to bibtex in TeX Live 2009 on
my machine.  LilyPond fails to compile the bibliographies without it.

Here are the references for background on this issue:

  http://tug.org/pipermail/tlbuild/2010q1/001304.html
  http://bugs.archlinux.org/task/17978

Does the patch look okay?

(I'm not very familiar with good/bad practices with respect to Python yet)

Thanks,
Patrick
>From 6eac10c4401f3c8fdad3bec3c802bd31a6ca3333 Mon Sep 17 00:00:00 2001
From: Patrick McCarty <pnor...@gmail.com>
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 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/scripts/build/bib2html.py b/scripts/build/bib2html.py
index c16f21c..8434cbf 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)
 
-- 
1.6.6.1

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to