mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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. ........
This commit is contained in:
parent
69065afad3
commit
0a15003d0c
@ -98,7 +98,7 @@ def main(argv=sys.argv):
|
|||||||
return 1
|
return 1
|
||||||
all_files = True
|
all_files = True
|
||||||
elif opt == '-d':
|
elif opt == '-d':
|
||||||
doctreedir = val
|
doctreedir = path.abspath(val)
|
||||||
elif opt == '-c':
|
elif opt == '-c':
|
||||||
confdir = path.abspath(val)
|
confdir = path.abspath(val)
|
||||||
if not path.isfile(path.join(confdir, 'conf.py')):
|
if not path.isfile(path.join(confdir, 'conf.py')):
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
from os import path
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.parsers.rst import directives, roles
|
from docutils.parsers.rst import directives, roles
|
||||||
@ -66,10 +67,10 @@ class Sphinx(object):
|
|||||||
self.builderclasses = builtin_builders.copy()
|
self.builderclasses = builtin_builders.copy()
|
||||||
self.builder = None
|
self.builder = None
|
||||||
|
|
||||||
self.srcdir = srcdir
|
self.srcdir = path.abspath(srcdir)
|
||||||
self.confdir = confdir
|
self.confdir = path.abspath(confdir)
|
||||||
self.outdir = outdir
|
self.outdir = path.abspath(outdir)
|
||||||
self.doctreedir = doctreedir
|
self.doctreedir = path.abspath(doctreedir)
|
||||||
|
|
||||||
self._status = status
|
self._status = status
|
||||||
self._warning = warning
|
self._warning = warning
|
||||||
@ -90,6 +91,13 @@ class Sphinx(object):
|
|||||||
# now that we know all config values, collect them from conf.py
|
# now that we know all config values, collect them from conf.py
|
||||||
self.config.init_values()
|
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:
|
if buildername is None:
|
||||||
print >>status, 'No builder selected, using default: html'
|
print >>status, 'No builder selected, using default: html'
|
||||||
buildername = 'html'
|
buildername = 'html'
|
||||||
|
@ -1030,6 +1030,9 @@ class ChangesBuilder(Builder):
|
|||||||
libchanges = {}
|
libchanges = {}
|
||||||
apichanges = []
|
apichanges = []
|
||||||
otherchanges = {}
|
otherchanges = {}
|
||||||
|
if version not in self.env.versionchanges:
|
||||||
|
self.info(bold('no changes in this version.'))
|
||||||
|
return
|
||||||
self.info(bold('writing summary file...'))
|
self.info(bold('writing summary file...'))
|
||||||
for type, docname, lineno, module, descname, content in \
|
for type, docname, lineno, module, descname, content in \
|
||||||
self.env.versionchanges[version]:
|
self.env.versionchanges[version]:
|
||||||
|
@ -350,6 +350,7 @@ class TextTranslator(nodes.NodeVisitor):
|
|||||||
|
|
||||||
def visit_image(self, node):
|
def visit_image(self, node):
|
||||||
self.add_text('[image]')
|
self.add_text('[image]')
|
||||||
|
raise nodes.SkipNode
|
||||||
|
|
||||||
def visit_transition(self, node):
|
def visit_transition(self, node):
|
||||||
indent = sum(self.stateindent)
|
indent = sum(self.stateindent)
|
||||||
|
@ -58,6 +58,7 @@ today_fmt = '%B %d, %Y'
|
|||||||
# List of directories, relative to source directories, that shouldn't be searched
|
# List of directories, relative to source directories, that shouldn't be searched
|
||||||
# for source files.
|
# for source files.
|
||||||
#exclude_dirs = []
|
#exclude_dirs = []
|
||||||
|
exclude_trees = ['_build']
|
||||||
|
|
||||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
#add_function_parentheses = True
|
#add_function_parentheses = True
|
||||||
|
@ -10,11 +10,12 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import difflib
|
||||||
import htmlentitydefs
|
import htmlentitydefs
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from etree13 import ElementTree as ET
|
|
||||||
|
|
||||||
from util import *
|
from util import *
|
||||||
|
from etree13 import ElementTree as ET
|
||||||
|
|
||||||
from sphinx.builder import StandaloneHTMLBuilder, LaTeXBuilder
|
from sphinx.builder import StandaloneHTMLBuilder, LaTeXBuilder
|
||||||
|
|
||||||
@ -66,14 +67,17 @@ class NslessParser(ET.XMLParser):
|
|||||||
def test_html(app):
|
def test_html(app):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
html_warnings = html_warnfile.getvalue().replace(os.sep, '/')
|
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:
|
if not ET:
|
||||||
return
|
return
|
||||||
for fname, paths in HTML_XPATH.iteritems():
|
for fname, paths in HTML_XPATH.iteritems():
|
||||||
parser = NslessParser()
|
parser = NslessParser()
|
||||||
parser.entity.update(htmlentitydefs.entitydefs)
|
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():
|
for path, text in paths.iteritems():
|
||||||
nodes = list(etree.findall(path))
|
nodes = list(etree.findall(path))
|
||||||
assert nodes != []
|
assert nodes != []
|
||||||
@ -92,4 +96,22 @@ def test_html(app):
|
|||||||
def test_latex(app):
|
def test_latex(app):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
latex_warnings = latex_warnfile.getvalue().replace(os.sep, '/')
|
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
|
||||||
|
|
||||||
|
@with_testapp(buildername='linkcheck')
|
||||||
|
def test_linkcheck(app):
|
||||||
|
app.builder.build_all()
|
||||||
|
|
||||||
|
@with_testapp(buildername='text')
|
||||||
|
def test_text(app):
|
||||||
|
app.builder.build_all()
|
||||||
|
|
||||||
|
@with_testapp(buildername='changes')
|
||||||
|
def test_changes(app):
|
||||||
|
app.builder.build_all()
|
||||||
|
@ -135,10 +135,10 @@ class TestApp(application.Sphinx):
|
|||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
trees = [self.outdir, self.doctreedir]
|
trees = [self.outdir, self.doctreedir]
|
||||||
#f self.made_builddir:
|
if self.made_builddir:
|
||||||
# trees.append(self.builddir)
|
trees.append(self.builddir)
|
||||||
#for tree in trees:
|
for tree in trees:
|
||||||
# shutil.rmtree(tree, True)
|
shutil.rmtree(tree, True)
|
||||||
|
|
||||||
|
|
||||||
def with_testapp(*args, **kwargs):
|
def with_testapp(*args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user