[Python-checkins] r65557 - in doctools/trunk: sphinx/latexwriter.py tests/root/markup.txt tests/test_build.py

georg.brandl python-checkins at python.org
Wed Aug 6 17:13:42 CEST 2008


Author: georg.brandl
Date: Wed Aug  6 17:13:42 2008
New Revision: 65557

Log:
Merged revisions 65556 via svnmerge from 
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x

........
  r65556 | georg.brandl | 2008-08-06 15:12:43 +0000 (Wed, 06 Aug 2008) | 2 lines
  
  Run latex over the latex builder's output.
........


Modified:
   doctools/trunk/   (props changed)
   doctools/trunk/sphinx/latexwriter.py
   doctools/trunk/tests/root/markup.txt
   doctools/trunk/tests/test_build.py

Modified: doctools/trunk/sphinx/latexwriter.py
==============================================================================
--- doctools/trunk/sphinx/latexwriter.py	(original)
+++ doctools/trunk/sphinx/latexwriter.py	Wed Aug  6 17:13:42 2008
@@ -97,6 +97,8 @@
     sectionnames = ["part", "chapter", "section", "subsection",
                     "subsubsection", "paragraph", "subparagraph"]
 
+    ignore_missing_images = False
+
     def __init__(self, document, builder):
         nodes.NodeVisitor.__init__(self, document)
         self.builder = builder
@@ -665,6 +667,9 @@
         if node['uri'] in self.builder.images:
             uri = self.builder.images[node['uri']]
         else:
+            # missing image!
+            if self.ignore_missing_images:
+                return
             uri = node['uri']
         if uri.find('://') != -1:
             # ignore remote images

Modified: doctools/trunk/tests/root/markup.txt
==============================================================================
--- doctools/trunk/tests/root/markup.txt	(original)
+++ doctools/trunk/tests/root/markup.txt	Wed Aug  6 17:13:42 2008
@@ -18,14 +18,14 @@
 
    Warning text.
 
-.. tip:
+.. tip::
    Tip text.
 
 
 Tables
 ------
 
-.. tabularcolumns:: |L|L|R|
+.. tabularcolumns:: |L|p{5cm}|R|
 
 +----+----------------+----+
 | 1  | * Block elems  |  x |
@@ -42,7 +42,7 @@
    Some funny **stuff**.
 
 .. versionchanged:: 0.5
-   Even more funny stuff. [#]_
+   Even more funny stuff.
 
 .. deprecated:: 0.4
    Boring stuff.
@@ -51,6 +51,8 @@
 Misc stuff
 ----------
 
+Stuff [#]_
+
 .. seealso::
 
    `Google <http://www.google.com>`_

Modified: doctools/trunk/tests/test_build.py
==============================================================================
--- doctools/trunk/tests/test_build.py	(original)
+++ doctools/trunk/tests/test_build.py	Wed Aug  6 17:13:42 2008
@@ -13,11 +13,13 @@
 import difflib
 import htmlentitydefs
 from StringIO import StringIO
+from subprocess import Popen, PIPE
 
 from util import *
 from etree13 import ElementTree as ET
 
 from sphinx.builder import StandaloneHTMLBuilder, LaTeXBuilder
+from sphinx.latexwriter import LaTeXTranslator
 
 
 html_warnfile = StringIO()
@@ -94,6 +96,7 @@
 
 @with_testapp(buildername='latex', warning=latex_warnfile)
 def test_latex(app):
+    LaTeXTranslator.ignore_missing_images = True
     app.builder.build_all()
     latex_warnings = latex_warnfile.getvalue().replace(os.sep, '/')
     latex_warnings_exp = LATEX_WARNINGS % {'root': app.srcdir}
@@ -101,6 +104,23 @@
            '\n'.join(difflib.ndiff(latex_warnings_exp.splitlines(),
                                    latex_warnings.splitlines()))
 
+    # now, try to run latex over it
+    cwd = os.getcwd()
+    os.chdir(app.outdir)
+    try:
+        try:
+            p = Popen(['pdflatex', '--interaction=nonstopmode', 'SphinxTests.tex'],
+                      stdout=PIPE, stderr=PIPE)
+        except OSError, err:
+            pass  # most likely pdflatex was not found
+        else:
+            stdout, stderr = p.communicate()
+            if p.returncode != 0:
+                print stdout
+                del app.cleanup_trees[:]
+                assert False, 'latex exited with error'
+    finally:
+        os.chdir(cwd)
 
 # just let the remaining ones run for now
 


More information about the Python-checkins mailing list