mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with stable
This commit is contained in:
commit
81b10b9b73
12
CHANGES
12
CHANGES
@ -139,6 +139,18 @@ Bugs fixed
|
||||
|
||||
* #979, #1266: Fix exclude handling in ``sphinx-apidoc``.
|
||||
|
||||
* #1302: Fix regression in :mod:`sphinx.ext.inheritance_diagram` when
|
||||
documenting classes that can't be pickled.
|
||||
|
||||
* #1316: Remove hard-coded ``font-face`` resources from epub theme.
|
||||
|
||||
* #1329: Fix traceback with empty translation msgstr in .po files.
|
||||
|
||||
* #1300: Fix references not working in translated documents in some instances.
|
||||
|
||||
* #1283: Fix a bug in the detection of changed files that would try to access
|
||||
doctrees of deleted documents.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
|
160
doc/Makefile
160
doc/Makefile
@ -4,157 +4,15 @@
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = python ../sphinx-build.py
|
||||
PAPER =
|
||||
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) \
|
||||
$(SPHINXOPTS) $(O) .
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(O) .
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml text man pickle json htmlhelp \
|
||||
qthelp devhelp epub latex latexpdf changes linkcheck doctest xml \
|
||||
pseudoxml
|
||||
SPHINXPROJ = sphinx
|
||||
SOURCEDIR = .
|
||||
BUILDDIR = _build
|
||||
|
||||
# Has to be explicit, otherwise we don't get "make" without targets right.
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files called index.html in directories"
|
||||
@echo " singlehtml to make one big HTML file"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make json files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make Qt help files and project"
|
||||
@echo " devhelp to make Devhelp files and project"
|
||||
@echo " epub to make an epub file"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run pdflatex"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview over all changed/added/deprecated items"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
clean:
|
||||
rm -rf _build/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in _build/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) _build/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in _build/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) _build/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in _build/singlehtml."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) _build/text
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) _build/man
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) _build/json
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in _build/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) _build/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run qcollectiongenerator with the" \
|
||||
".qhcp project file in build/qthelp."
|
||||
@echo "# qcollectiongenerator _build/qthelp/Sphinx.qhcp"
|
||||
@echo "To view the help collection:"
|
||||
@echo "# assistant -collectionFile _build/qthelp/Sphinx.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) _build/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/sphinx"
|
||||
@echo "# ln -s _build/devhelp $$HOME/.local/share/devhelp/sphinx"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) _build/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in _build/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in _build/latex."
|
||||
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
|
||||
"run these through (pdf)latex."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
make -C _build/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in _build/latex."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) _build/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in _build/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes
|
||||
@echo
|
||||
@echo "The overview file is in _build/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in _build/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) _build/doctest
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) _build/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in _build/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) _build/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C _build/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in _build/texinfo."
|
||||
|
||||
xml:
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) _build/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in _build/XML."
|
||||
|
||||
pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) _build/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in _build/pseudoxml."
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%:
|
||||
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
@ -11,5 +11,8 @@
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
from sphinx import main
|
||||
sys.exit(main(sys.argv))
|
||||
from sphinx import main, make_main
|
||||
if sys.argv[1:2] == ['-M']:
|
||||
sys.exit(make_main(sys.argv))
|
||||
else:
|
||||
sys.exit(main(sys.argv))
|
||||
|
@ -81,5 +81,11 @@ def main(argv=sys.argv):
|
||||
return cmdline.main(argv)
|
||||
|
||||
|
||||
def make_main(argv=sys.argv):
|
||||
"""Sphinx build "make mode" entry."""
|
||||
from sphinx import make_mode
|
||||
return make_mode.run_make_mode(argv[2:])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
|
@ -265,6 +265,12 @@ class Builder(object):
|
||||
self.info(bold('no targets are out of date.'))
|
||||
return
|
||||
|
||||
# filter "docnames" (list of outdated files) by the updated
|
||||
# found_docs of the environment; this will remove docs that
|
||||
# have since been removed
|
||||
if docnames != ['__all__']:
|
||||
docnames = set(docnames) & self.env.found_docs
|
||||
|
||||
# another indirection to support builders that don't build
|
||||
# files individually
|
||||
self.write(docnames, list(updated_docnames), method)
|
||||
@ -289,6 +295,7 @@ class Builder(object):
|
||||
docnames = set(build_docnames) | set(updated_docnames)
|
||||
else:
|
||||
docnames = set(build_docnames)
|
||||
self.app.debug('docnames to write: %s', ', '.join(sorted(docnames)))
|
||||
|
||||
# add all toctree-containing files that may have changed
|
||||
for docname in list(docnames):
|
||||
|
@ -42,6 +42,7 @@ General options
|
||||
-d <path> path for the cached environment and doctree files
|
||||
(default: outdir/.doctrees)
|
||||
-j <N> build in parallel with N processes where possible
|
||||
-M <builder> "make" mode -- used by Makefile, like "sphinx-build -M html"
|
||||
|
||||
Build configuration options
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -82,19 +83,28 @@ def main(argv):
|
||||
# Windows' poor cmd box doesn't understand ANSI sequences
|
||||
nocolor()
|
||||
|
||||
# parse options
|
||||
try:
|
||||
opts, args = getopt.getopt(argv[1:], 'ab:t:d:c:CD:A:nNEqQWw:PThvj:',
|
||||
['help', 'version'])
|
||||
allopts = set(opt[0] for opt in opts)
|
||||
if '-h' in allopts or '--help' in allopts:
|
||||
usage(argv)
|
||||
print >>sys.stderr
|
||||
print >>sys.stderr, 'For more information, see '\
|
||||
'<http://sphinx-doc.org/>.'
|
||||
return 0
|
||||
if '--version' in allopts:
|
||||
print 'Sphinx (sphinx-build) %s' % __version__
|
||||
return 0
|
||||
except getopt.error, err:
|
||||
usage(argv, 'Error: %s' % err)
|
||||
return 1
|
||||
|
||||
# handle basic options
|
||||
allopts = set(opt[0] for opt in opts)
|
||||
# help and version options
|
||||
if '-h' in allopts or '--help' in allopts:
|
||||
usage(argv)
|
||||
print >>sys.stderr
|
||||
print >>sys.stderr, 'For more information, see <http://sphinx-doc.org/>.'
|
||||
return 0
|
||||
if '--version' in allopts:
|
||||
print 'Sphinx (sphinx-build) %s' % __version__
|
||||
return 0
|
||||
|
||||
# get paths (first and second positional argument)
|
||||
try:
|
||||
srcdir = confdir = abspath(args[0])
|
||||
if not path.isdir(srcdir):
|
||||
print >>sys.stderr, 'Error: Cannot find source directory `%s\'.' % (
|
||||
@ -103,12 +113,9 @@ def main(argv):
|
||||
if not path.isfile(path.join(srcdir, 'conf.py')) and \
|
||||
'-c' not in allopts and '-C' not in allopts:
|
||||
print >>sys.stderr, ('Error: Source directory doesn\'t '
|
||||
'contain conf.py file.')
|
||||
'contain a conf.py file.')
|
||||
return 1
|
||||
outdir = abspath(args[1])
|
||||
except getopt.error, err:
|
||||
usage(argv, 'Error: %s' % err)
|
||||
return 1
|
||||
except IndexError:
|
||||
usage(argv, 'Error: Insufficient arguments.')
|
||||
return 1
|
||||
@ -118,6 +125,7 @@ def main(argv):
|
||||
'encoding (%r).' % fs_encoding)
|
||||
return 1
|
||||
|
||||
# handle remaining filename arguments
|
||||
filenames = args[2:]
|
||||
err = 0
|
||||
for filename in filenames:
|
||||
|
@ -178,6 +178,9 @@ def render_dot(self, code, options, format, prefix='graphviz'):
|
||||
if p.returncode != 0:
|
||||
raise GraphvizError('dot exited with error:\n[stderr]\n%s\n'
|
||||
'[stdout]\n%s' % (stderr, stdout))
|
||||
if not path.isfile(outfn):
|
||||
raise GraphvizError('dot did not produce an output file:\n[stderr]\n%s\n'
|
||||
'[stdout]\n%s' % (stderr, stdout))
|
||||
return relfn, outfn
|
||||
|
||||
|
||||
|
@ -154,8 +154,18 @@ class InheritanceGraph(object):
|
||||
nodename = self.class_name(cls, parts)
|
||||
fullname = self.class_name(cls, 0)
|
||||
|
||||
# Use first line of docstring as tooltip, if available
|
||||
tooltip = None
|
||||
try:
|
||||
if cls.__doc__:
|
||||
doc = cls.__doc__.strip().split("\n")[0]
|
||||
if doc:
|
||||
tooltip = '"%s"' % doc.replace('"', '\\"')
|
||||
except Exception: # might raise AttributeError for strange classes
|
||||
pass
|
||||
|
||||
baselist = []
|
||||
all_classes[cls] = (nodename, fullname, baselist)
|
||||
all_classes[cls] = (nodename, fullname, baselist, tooltip)
|
||||
for base in cls.__bases__:
|
||||
if not show_builtins and base in builtins:
|
||||
continue
|
||||
@ -168,7 +178,7 @@ class InheritanceGraph(object):
|
||||
for cls in classes:
|
||||
recurse(cls)
|
||||
|
||||
return all_classes
|
||||
return all_classes.values()
|
||||
|
||||
def class_name(self, cls, parts=0):
|
||||
"""Given a class object, return a fully-qualified name.
|
||||
@ -188,7 +198,7 @@ class InheritanceGraph(object):
|
||||
|
||||
def get_all_class_names(self):
|
||||
"""Get all of the class names involved in the graph."""
|
||||
return [fullname for (_, fullname, _) in self.class_info.values()]
|
||||
return [fullname for (_, fullname, _, _) in self.class_info]
|
||||
|
||||
# These are the default attrs for graphviz
|
||||
default_graph_attrs = {
|
||||
@ -241,17 +251,13 @@ class InheritanceGraph(object):
|
||||
res.append('digraph %s {\n' % name)
|
||||
res.append(self._format_graph_attrs(g_attrs))
|
||||
|
||||
for cls, (name, fullname, bases) in sorted(self.class_info.items()):
|
||||
for name, fullname, bases, tooltip in sorted(self.class_info):
|
||||
# Write the node
|
||||
this_node_attrs = n_attrs.copy()
|
||||
if fullname in urls:
|
||||
this_node_attrs['URL'] = '"%s"' % urls[fullname]
|
||||
# Use first line of docstring as tooltip, if available
|
||||
if cls.__doc__:
|
||||
doc = cls.__doc__.strip().split("\n")[0]
|
||||
if doc:
|
||||
doc = doc.replace('"', '\\"')
|
||||
this_node_attrs['tooltip'] = '"%s"' % doc
|
||||
if tooltip:
|
||||
this_node_attrs['tooltip'] = tooltip
|
||||
res.append(' "%s" [%s];\n' %
|
||||
(name, self._format_node_attrs(this_node_attrs)))
|
||||
|
||||
|
252
sphinx/make_mode.py
Normal file
252
sphinx/make_mode.py
Normal file
@ -0,0 +1,252 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
sphinx.make_mode
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
sphinx-build -M command-line handling.
|
||||
|
||||
This replaces the old, platform-dependent and once-generated content
|
||||
of Makefile / make.bat.
|
||||
|
||||
This is in its own module so that importing it is fast. It should not
|
||||
import the main Sphinx modules (like sphinx.applications, sphinx.builders).
|
||||
|
||||
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
|
||||
:license: BSD, see LICENSE for details.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
from os import path
|
||||
from subprocess import call
|
||||
|
||||
import sphinx
|
||||
from sphinx.util.console import bold, blue
|
||||
|
||||
proj_name = os.getenv('SPHINXPROJ', '<project>')
|
||||
|
||||
|
||||
BUILDERS = [
|
||||
("", "html", "to make standalone HTML files"),
|
||||
("", "dirhtml", "to make HTML files named index.html in directories"),
|
||||
("", "singlehtml","to make a single large HTML file"),
|
||||
("", "pickle", "to make pickle files"),
|
||||
("", "json", "to make JSON files"),
|
||||
("", "htmlhelp", "to make HTML files and a HTML help project"),
|
||||
("", "qthelp", "to make HTML files and a qthelp project"),
|
||||
("", "devhelp", "to make HTML files and a Devhelp project"),
|
||||
("", "epub", "to make an epub"),
|
||||
("", "latex", "to make LaTeX files, you can set PAPER=a4 or PAPER=letter"),
|
||||
("posix", "latexpdf", "to make LaTeX files and run them through pdflatex"),
|
||||
("posix", "latexpdfja","to make LaTeX files and run them through platex/dvipdfmx"),
|
||||
("", "text", "to make text files"),
|
||||
("", "man", "to make manual pages"),
|
||||
("", "texinfo", "to make Texinfo files"),
|
||||
("posix", "info", "to make Texinfo files and run them through makeinfo"),
|
||||
("", "gettext", "to make PO message catalogs"),
|
||||
("", "changes", "to make an overview of all changed/added/deprecated items"),
|
||||
("", "xml", "to make Docutils-native XML files"),
|
||||
("", "pseudoxml", "to make pseudoxml-XML files for display purposes"),
|
||||
("", "linkcheck", "to check all external links for integrity"),
|
||||
("", "doctest", "to run all doctests embedded in the documentation (if enabled)"),
|
||||
("", "coverage", "to run coverage check of the documentation (if enabled)"),
|
||||
]
|
||||
|
||||
|
||||
class Make(object):
|
||||
|
||||
def __init__(self, srcdir, builddir, opts):
|
||||
self.srcdir = srcdir
|
||||
self.builddir = builddir
|
||||
self.opts = opts
|
||||
|
||||
def builddir_join(self, *comps):
|
||||
return path.join(self.builddir, *comps)
|
||||
|
||||
def build_clean(self):
|
||||
if not path.exists(self.builddir):
|
||||
return
|
||||
elif not path.isdir(self.builddir):
|
||||
print "Error: %r is not a directory!" % self.builddir
|
||||
return 1
|
||||
print "Removing everything under %r..." % self.builddir
|
||||
for item in os.listdir(self.builddir):
|
||||
shutil.rmtree(self.builddir_join(item))
|
||||
|
||||
def build_help(self):
|
||||
print bold("Sphinx v%s" % sphinx.__version__)
|
||||
print "Please use `make %s' where %s is one of" % ((blue('target'),)*2)
|
||||
for osname, bname, description in BUILDERS:
|
||||
if not osname or os.name == osname:
|
||||
print ' %s %s' % (blue(bname.ljust(10)), description)
|
||||
|
||||
def build_html(self):
|
||||
if self.run_generic_build('html') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished. The HTML pages are in %s.' % self.builddir_join('html')
|
||||
|
||||
def build_dirhtml(self):
|
||||
if self.run_generic_build('dirhtml') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished. The HTML pages are in %s.' % self.builddir_join('dirhtml')
|
||||
|
||||
def build_singlehtml(self):
|
||||
if self.run_generic_build('singlehtml') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished. The HTML page is in %s.' % self.builddir_join('singlehtml')
|
||||
|
||||
def build_pickle(self):
|
||||
if self.run_generic_build('pickle') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished; now you can process the pickle files.'
|
||||
|
||||
def build_json(self):
|
||||
if self.run_generic_build('json') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished; now you can process the JSON files.'
|
||||
|
||||
def build_htmlhelp(self):
|
||||
if self.run_generic_build('htmlhelp') > 0:
|
||||
return 1
|
||||
print
|
||||
print ('Build finished; now you can run HTML Help Workshop with the '
|
||||
'.hhp project file in %s.') % self.builddir_join('htmlhelp')
|
||||
|
||||
def build_qthelp(self):
|
||||
if self.run_generic_build('qthelp') > 0:
|
||||
return 1
|
||||
print
|
||||
print ('Build finished; now you can run "qcollectiongenerator" with the '
|
||||
'.qhcp project file in %s, like this:') % self.builddir_join('qthelp')
|
||||
print '$ qcollectiongenerator %s.qhcp' % self.builddir_join('qthelp', proj_name)
|
||||
print 'To view the help file:'
|
||||
print '$ assistant -collectionFile %s.qhc' % self.builddir_join('qthelp', proj_name)
|
||||
|
||||
def build_devhelp(self):
|
||||
if self.run_generic_build('devhelp') > 0:
|
||||
return 1
|
||||
print
|
||||
print "Build finished."
|
||||
print "To view the help file:"
|
||||
print "$ mkdir -p $HOME/.local/share/devhelp/" + proj_name
|
||||
print "$ ln -s %s $HOME/.local/share/devhelp/%s" % \
|
||||
(self.builddir_join('devhelp'), proj_name)
|
||||
print "$ devhelp"
|
||||
|
||||
def build_epub(self):
|
||||
if self.run_generic_build('epub') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished. The ePub file is in %s.' % self.builddir_join('epub')
|
||||
|
||||
def build_latex(self):
|
||||
if self.run_generic_build('latex') > 0:
|
||||
return 1
|
||||
print "Build finished; the LaTeX files are in %s." % self.builddir_join('latex')
|
||||
if os.name == 'posix':
|
||||
print "Run `make' in that directory to run these through (pdf)latex"
|
||||
print "(use `make latexpdf' here to do that automatically)."
|
||||
|
||||
def build_latexpdf(self):
|
||||
if self.run_generic_build('latex') > 0:
|
||||
return 1
|
||||
os.system('make -C %s all-pdf' % self.builddir_join('latex'))
|
||||
|
||||
def build_latexpdfja(self):
|
||||
if self.run_generic_build('latex') > 0:
|
||||
return 1
|
||||
os.system('make -C %s all-pdf-ja' % self.builddir_join('latex'))
|
||||
|
||||
def build_text(self):
|
||||
if self.run_generic_build('text') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished. The text files are in %s.' % self.builddir_join('text')
|
||||
|
||||
def build_texinfo(self):
|
||||
if self.run_generic_build('texinfo') > 0:
|
||||
return 1
|
||||
print "Build finished; the Texinfo files are in %s." % self.builddir_join('texinfo')
|
||||
if os.name == 'posix':
|
||||
print "Run `make' in that directory to run these through makeinfo"
|
||||
print "(use `make info' here to do that automatically)."
|
||||
|
||||
def build_info(self):
|
||||
if self.run_generic_build('texinfo') > 0:
|
||||
return 1
|
||||
os.system('make -C %s info' % self.builddir_join('texinfo'))
|
||||
|
||||
def build_gettext(self):
|
||||
dtdir = self.builddir_join('gettext', '.doctrees')
|
||||
if self.run_generic_build('gettext', doctreedir=dtdir) > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished. The message catalogs are in %s.' % self.builddir_join('gettext')
|
||||
|
||||
def build_changes(self):
|
||||
if self.run_generic_build('changes') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished. The overview file is in %s.' % self.builddir_join('changes')
|
||||
|
||||
def build_linkcheck(self):
|
||||
res = self.run_generic_build('linkcheck')
|
||||
print
|
||||
print ('Link check complete; look for any errors in the above output '
|
||||
'or in %s.') % self.builddir_join('linkcheck', 'output.txt')
|
||||
return res
|
||||
|
||||
def build_doctest(self):
|
||||
res = self.run_generic_build('doctest')
|
||||
print ("Testing of doctests in the sources finished, look at the "
|
||||
"results in %s." % self.builddir_join('doctest', 'output.txt'))
|
||||
return res
|
||||
|
||||
def build_coverage(self):
|
||||
if self.run_generic_build('coverage') > 0:
|
||||
print "Has the coverage extension been enabled?"
|
||||
return 1
|
||||
print
|
||||
print ("Testing of coverage in the sources finished, look at the "
|
||||
"results in %s." % self.builddir_join('coverage'))
|
||||
|
||||
def build_xml(self):
|
||||
if self.run_generic_build('xml') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished. The XML files are in %s.' % self.builddir_join('xml')
|
||||
|
||||
def build_pseudoxml(self):
|
||||
if self.run_generic_build('pseudoxml') > 0:
|
||||
return 1
|
||||
print
|
||||
print 'Build finished. The pseudo-XML files are in %s.' % self.builddir_join('pseudoxml')
|
||||
|
||||
def run_generic_build(self, builder, doctreedir=None):
|
||||
# compatibility with old Makefile
|
||||
papersize = os.getenv('PAPER', '')
|
||||
opts = self.opts
|
||||
if papersize in ('a4', 'letter'):
|
||||
opts.extend(['-D', 'latex_paper_size=' + papersize])
|
||||
if doctreedir is None:
|
||||
doctreedir = self.builddir_join('doctrees')
|
||||
return call([sys.executable, sys.argv[0], '-b', builder,
|
||||
'-d', doctreedir, self.srcdir, self.builddir_join(builder)] + opts)
|
||||
|
||||
|
||||
def run_make_mode(args):
|
||||
if len(args) < 3:
|
||||
print >>sys.stderr, ('Error: at least 3 arguments (builder, source '
|
||||
'dir, build dir) are required.')
|
||||
return 1
|
||||
make = Make(args[1], args[2], args[3:])
|
||||
run_method = 'build_' + args[0]
|
||||
if hasattr(make, run_method):
|
||||
return getattr(make, run_method)()
|
||||
return make.run_generic_build(args[0])
|
@ -840,6 +840,76 @@ if "%%1" == "pseudoxml" (
|
||||
:end
|
||||
'''
|
||||
|
||||
# This will become the Makefile template for Sphinx 1.5.
|
||||
MAKEFILE_NEW = u'''\
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
SPHINXPROJ = %(project_fn)s
|
||||
SOURCEDIR = %(rsrcdir)s
|
||||
BUILDDIR = %(rbuilddir)s
|
||||
|
||||
# User-friendly check for sphinx-build.
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error \
|
||||
The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx \
|
||||
installed, then set the SPHINXBUILD environment variable to point \
|
||||
to the full path of the '$(SPHINXBUILD)' executable. Alternatively you \
|
||||
can add the directory with the executable to your PATH. \
|
||||
If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
# Has to be explicit, otherwise we don't get "make" without targets right.
|
||||
help:
|
||||
\t@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
# You can add custom targets here.
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%:
|
||||
\t@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
'''
|
||||
|
||||
# This will become the make.bat template for Sphinx 1.5.
|
||||
BATCHFILE_NEW = u'''\
|
||||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%%SPHINXBUILD%%" == "" (
|
||||
\tset SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=%(rbuilddir)s
|
||||
set SPHINXPROJ=%(project_fn)s
|
||||
|
||||
if "%%1" == "" goto help
|
||||
|
||||
%%SPHINXBUILD%% 2> nul
|
||||
if errorlevel 9009 (
|
||||
\techo.
|
||||
\techo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
\techo.installed, then set the SPHINXBUILD environment variable to point
|
||||
\techo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
\techo.may add the Sphinx directory to PATH.
|
||||
\techo.
|
||||
\techo.If you don't have Sphinx installed, grab it from
|
||||
\techo.http://sphinx-doc.org/
|
||||
\texit /b 1
|
||||
)
|
||||
|
||||
%%SPHINXBUILD%% -M %%1 %%BUILDDIR%% %%SPHINXOPTS%%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%%SPHINXBUILD%% -M help %%BUILDDIR%% %%SPHINXOPTS%%
|
||||
|
||||
:end
|
||||
'''
|
||||
|
||||
|
||||
def mkdir_p(dir):
|
||||
if path.isdir(dir):
|
||||
|
@ -339,7 +339,7 @@ dl.glossary dt {
|
||||
/* -- code displays --------------------------------------------------------- */
|
||||
|
||||
pre {
|
||||
font-family: "LiberationNarrow", monospace;
|
||||
font-family: monospace;
|
||||
overflow: auto;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
@ -360,7 +360,7 @@ table.highlighttable td {
|
||||
}
|
||||
|
||||
tt {
|
||||
font-family: "LiberationNarrow", monospace;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
tt.descname {
|
||||
@ -432,6 +432,7 @@ table .link-target {
|
||||
|
||||
/* -- font-face ------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
@font-face {
|
||||
font-family: "LiberationNarrow";
|
||||
font-style: normal;
|
||||
@ -460,4 +461,4 @@ table .link-target {
|
||||
src: url("res:///Data/fonts/LiberationNarrow-BoldItalic.otf")
|
||||
format("opentype");
|
||||
}
|
||||
|
||||
*/
|
@ -195,7 +195,10 @@ class Locale(Transform):
|
||||
patch = new_document(source, settings)
|
||||
CustomLocaleReporter(node.source, node.line).set_reporter(patch)
|
||||
parser.parse(msgstr, patch)
|
||||
patch = patch[0]
|
||||
try:
|
||||
patch = patch[0]
|
||||
except IndexError: # empty node
|
||||
pass
|
||||
# XXX doctest and other block markup
|
||||
if not isinstance(patch, nodes.paragraph):
|
||||
continue # skip for now
|
||||
@ -238,8 +241,7 @@ class Locale(Transform):
|
||||
self.document.ids.pop(_id, None)
|
||||
|
||||
# re-entry with new named section node.
|
||||
self.document.note_implicit_target(
|
||||
section_node, section_node)
|
||||
self.document.note_implicit_target(section_node)
|
||||
|
||||
# replace target's refname to new target name
|
||||
def is_named_target(node):
|
||||
@ -298,7 +300,10 @@ class Locale(Transform):
|
||||
patch = new_document(source, settings)
|
||||
CustomLocaleReporter(node.source, node.line).set_reporter(patch)
|
||||
parser.parse(msgstr, patch)
|
||||
patch = patch[0]
|
||||
try:
|
||||
patch = patch[0]
|
||||
except IndexError: # empty node
|
||||
pass
|
||||
# XXX doctest and other block markup
|
||||
if not isinstance(patch, nodes.paragraph):
|
||||
continue # skip for now
|
||||
|
Loading…
Reference in New Issue
Block a user