[Python-checkins] r65527 - in doctools/trunk: sphinx/__init__.py sphinx/application.py sphinx/builder.py sphinx/textwriter.py tests/root/conf.py tests/test_build.py tests/util.py
georg.brandl
python-checkins at python.org
Mon Aug 4 23:48:12 CEST 2008
Author: georg.brandl
Date: Mon Aug 4 23:48:12 2008
New Revision: 65527
Log:
Merged revisions 65498-65499,65526 via svnmerge from
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x
........
r65498 | georg.brandl | 2008-08-04 17:07:33 +0000 (Mon, 04 Aug 2008) | 2 lines
Absolutize doctreedir when parsing from commandline.
........
r65499 | georg.brandl | 2008-08-04 17:17:49 +0000 (Mon, 04 Aug 2008) | 4 lines
If output and/or doctree directory are within the source directory,
except them from the search for source files.
........
r65526 | georg.brandl | 2008-08-04 21:46:41 +0000 (Mon, 04 Aug 2008) | 2 lines
Let the test suite run the text, linkcheck, and changes builders.
........
Modified:
doctools/trunk/ (props changed)
doctools/trunk/sphinx/__init__.py
doctools/trunk/sphinx/application.py
doctools/trunk/sphinx/builder.py
doctools/trunk/sphinx/textwriter.py
doctools/trunk/tests/root/conf.py
doctools/trunk/tests/test_build.py
doctools/trunk/tests/util.py
Modified: doctools/trunk/sphinx/__init__.py
==============================================================================
--- doctools/trunk/sphinx/__init__.py (original)
+++ doctools/trunk/sphinx/__init__.py Mon Aug 4 23:48:12 2008
@@ -98,7 +98,7 @@
return 1
all_files = True
elif opt == '-d':
- doctreedir = val
+ doctreedir = path.abspath(val)
elif opt == '-c':
confdir = path.abspath(val)
if not path.isfile(path.join(confdir, 'conf.py')):
Modified: doctools/trunk/sphinx/application.py
==============================================================================
--- doctools/trunk/sphinx/application.py (original)
+++ doctools/trunk/sphinx/application.py Mon Aug 4 23:48:12 2008
@@ -13,6 +13,7 @@
"""
import sys
+from os import path
from docutils import nodes
from docutils.parsers.rst import directives, roles
@@ -66,10 +67,10 @@
self.builderclasses = builtin_builders.copy()
self.builder = None
- self.srcdir = srcdir
- self.confdir = confdir
- self.outdir = outdir
- self.doctreedir = doctreedir
+ self.srcdir = path.abspath(srcdir)
+ self.confdir = path.abspath(confdir)
+ self.outdir = path.abspath(outdir)
+ self.doctreedir = path.abspath(doctreedir)
self._status = status
self._warning = warning
@@ -90,6 +91,13 @@
# now that we know all config values, collect them from conf.py
self.config.init_values()
+ # if the output and/or doctree dirs are within the source dir, except
+ # them from being searched for source files
+ if self.outdir.startswith(self.srcdir):
+ self.config.exclude_trees += [self.outdir[len(self.srcdir)+1:]]
+ if self.doctreedir.startswith(self.srcdir):
+ self.config.exclude_trees += [self.doctreedir[len(self.srcdir)+1:]]
+
if buildername is None:
print >>status, 'No builder selected, using default: html'
buildername = 'html'
Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py (original)
+++ doctools/trunk/sphinx/builder.py Mon Aug 4 23:48:12 2008
@@ -1030,6 +1030,9 @@
libchanges = {}
apichanges = []
otherchanges = {}
+ if version not in self.env.versionchanges:
+ self.info(bold('no changes in this version.'))
+ return
self.info(bold('writing summary file...'))
for type, docname, lineno, module, descname, content in \
self.env.versionchanges[version]:
Modified: doctools/trunk/sphinx/textwriter.py
==============================================================================
--- doctools/trunk/sphinx/textwriter.py (original)
+++ doctools/trunk/sphinx/textwriter.py Mon Aug 4 23:48:12 2008
@@ -350,6 +350,7 @@
def visit_image(self, node):
self.add_text('[image]')
+ raise nodes.SkipNode
def visit_transition(self, node):
indent = sum(self.stateindent)
Modified: doctools/trunk/tests/root/conf.py
==============================================================================
--- doctools/trunk/tests/root/conf.py (original)
+++ doctools/trunk/tests/root/conf.py Mon Aug 4 23:48:12 2008
@@ -58,6 +58,7 @@
# List of directories, relative to source directories, that shouldn't be searched
# for source files.
#exclude_dirs = []
+exclude_trees = ['_build']
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
Modified: doctools/trunk/tests/test_build.py
==============================================================================
--- doctools/trunk/tests/test_build.py (original)
+++ doctools/trunk/tests/test_build.py Mon Aug 4 23:48:12 2008
@@ -10,11 +10,12 @@
"""
import os
+import difflib
import htmlentitydefs
from StringIO import StringIO
-from etree13 import ElementTree as ET
from util import *
+from etree13 import ElementTree as ET
from sphinx.builder import StandaloneHTMLBuilder, LaTeXBuilder
@@ -66,14 +67,17 @@
def test_html(app):
app.builder.build_all()
html_warnings = html_warnfile.getvalue().replace(os.sep, '/')
- assert html_warnings == HTML_WARNINGS % {'root': app.srcdir}
+ html_warnings_exp = HTML_WARNINGS % {'root': app.srcdir}
+ assert html_warnings == html_warnings_exp, 'Warnings don\'t match:\n' + \
+ '\n'.join(difflib.ndiff(html_warnings_exp.splitlines(),
+ html_warnings.splitlines()))
if not ET:
return
for fname, paths in HTML_XPATH.iteritems():
parser = NslessParser()
parser.entity.update(htmlentitydefs.entitydefs)
- etree = ET.parse(app.outdir / fname, parser)
+ etree = ET.parse(os.path.join(app.outdir, fname), parser)
for path, text in paths.iteritems():
nodes = list(etree.findall(path))
assert nodes != []
@@ -92,4 +96,22 @@
def test_latex(app):
app.builder.build_all()
latex_warnings = latex_warnfile.getvalue().replace(os.sep, '/')
- assert latex_warnings == LATEX_WARNINGS % {'root': app.srcdir}
+ latex_warnings_exp = LATEX_WARNINGS % {'root': app.srcdir}
+ assert latex_warnings == latex_warnings_exp, 'Warnings don\'t match:\n' + \
+ '\n'.join(difflib.ndiff(latex_warnings_exp.splitlines(),
+ latex_warnings.splitlines()))
+
+
+# just let the remaining ones run for now
+
+ at with_testapp(buildername='linkcheck')
+def test_linkcheck(app):
+ app.builder.build_all()
+
+ at with_testapp(buildername='text')
+def test_text(app):
+ app.builder.build_all()
+
+ at with_testapp(buildername='changes')
+def test_changes(app):
+ app.builder.build_all()
Modified: doctools/trunk/tests/util.py
==============================================================================
--- doctools/trunk/tests/util.py (original)
+++ doctools/trunk/tests/util.py Mon Aug 4 23:48:12 2008
@@ -135,10 +135,10 @@
def cleanup(self):
trees = [self.outdir, self.doctreedir]
- #f self.made_builddir:
- # trees.append(self.builddir)
- #for tree in trees:
- # shutil.rmtree(tree, True)
+ if self.made_builddir:
+ trees.append(self.builddir)
+ for tree in trees:
+ shutil.rmtree(tree, True)
def with_testapp(*args, **kwargs):
More information about the Python-checkins
mailing list