[Python-checkins] r67156 - in doctools/trunk/sphinx: application.py builder.py ext/pngmath.py latexwriter.py

georg.brandl python-checkins at python.org
Sat Nov 8 09:14:59 CET 2008


Author: georg.brandl
Date: Sat Nov 8 09:14:59 2008
New Revision: 67156
Log:
More fixes.
Modified:
 doctools/trunk/sphinx/application.py
 doctools/trunk/sphinx/builder.py
 doctools/trunk/sphinx/ext/pngmath.py
 doctools/trunk/sphinx/latexwriter.py
Modified: doctools/trunk/sphinx/application.py
==============================================================================
--- doctools/trunk/sphinx/application.py	(original)
+++ doctools/trunk/sphinx/application.py	Sat Nov 8 09:14:59 2008
@@ -108,7 +108,8 @@
 if buildername not in self.builderclasses:
 raise SphinxError('Builder name %s not registered' % buildername)
 
- self.info(bold('Sphinx v%s, building %s' % (sphinx.__version__, buildername)))
+ self.info(bold('Sphinx v%s, building %s' % (sphinx.__released__,
+ buildername)))
 
 builderclass = self.builderclasses[buildername]
 self.builder = builderclass(self, freshenv=freshenv)
Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py	(original)
+++ doctools/trunk/sphinx/builder.py	Sat Nov 8 09:14:59 2008
@@ -1033,7 +1033,7 @@
 # extract toctree nodes from the tree and put them in a fresh document
 new_tree = new_document('<latex output>')
 new_sect = nodes.section()
- new_sect += nodes.title('<temp>', '<temp>')
+ new_sect += nodes.title(u'<Set title in conf.py>', u'<Set title in conf.py>')
 new_tree += new_sect
 for node in tree.traverse(addnodes.toctree):
 new_sect += node
Modified: doctools/trunk/sphinx/ext/pngmath.py
==============================================================================
--- doctools/trunk/sphinx/ext/pngmath.py	(original)
+++ doctools/trunk/sphinx/ext/pngmath.py	Sat Nov 8 09:14:59 2008
@@ -14,7 +14,7 @@
 import shutil
 import tempfile
 import posixpath
-from os import path
+from os import path, getcwd, chdir
 from subprocess import Popen, PIPE
 try:
 from hashlib import sha1 as sha
@@ -96,20 +96,30 @@
 tf.write(latex)
 tf.close()
 
+ # build latex command; old versions of latex don't have the
+ # --output-directory option, so we have to manually chdir to the
+ # temp dir to run it.
 ltx_args = shlex.split(self.builder.config.pngmath_latex)
- ltx_args += ['--interaction=nonstopmode', '--output-directory=' + tempdir,
- 'math.tex']
+ ltx_args += ['--interaction=nonstopmode', 'math.tex']
+
+ curdir = getcwd()
+ chdir(tempdir)
+
 try:
- p = Popen(ltx_args, stdout=PIPE, stderr=PIPE)
- except OSError, err:
- if err.errno != 2: # No such file or directory
- raise
- if not hasattr(self.builder, '_mathpng_warned_latex'):
- self.builder.warn('LaTeX command %r cannot be run (needed for math '
- 'display), check the pngmath_latex setting' %
- self.builder.config.pngmath_latex)
- self.builder._mathpng_warned_latex = True
- return relfn, None
+ try:
+ p = Popen(ltx_args, stdout=PIPE, stderr=PIPE)
+ except OSError, err:
+ if err.errno != 2: # No such file or directory
+ raise
+ if not hasattr(self.builder, '_mathpng_warned_latex'):
+ self.builder.warn('LaTeX command %r cannot be run (needed for math '
+ 'display), check the pngmath_latex setting' %
+ self.builder.config.pngmath_latex)
+ self.builder._mathpng_warned_latex = True
+ return relfn, None
+ finally:
+ chdir(curdir)
+
 stdout, stderr = p.communicate()
 if p.returncode != 0:
 raise MathExtError('latex exited with error:\n[stderr]\n%s\n[stdout]\n%s'
Modified: doctools/trunk/sphinx/latexwriter.py
==============================================================================
--- doctools/trunk/sphinx/latexwriter.py	(original)
+++ doctools/trunk/sphinx/latexwriter.py	Sat Nov 8 09:14:59 2008
@@ -877,7 +877,6 @@
 raise nodes.SkipNode
 
 def visit_reference(self, node):
- print node
 uri = node.get('refuri', '')
 if self.in_title or not uri:
 self.context.append('')


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /