[Python-modules-commits] [sphinx] 01/07: Import sphinx_1.4.3.orig.tar.gz
Dmitry Shachnev
mitya57 at moszumanska.debian.org
Mon Jun 6 16:51:04 UTC 2016
This is an automated email from the git hooks/post-receive script.
mitya57 pushed a commit to branch master
in repository sphinx.
commit bc6a3ea62ed1d5d3e9637c0f8ec0ff9123b211d0
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date: Mon Jun 6 19:45:29 2016 +0300
Import sphinx_1.4.3.orig.tar.gz
---
CHANGES | 94 +++++
Makefile | 9 +-
PKG-INFO | 2 +-
Sphinx.egg-info/PKG-INFO | 2 +-
Sphinx.egg-info/SOURCES.txt | 9 +
doc/config.rst | 23 +-
doc/devguide.rst | 2 +-
doc/ext/doctest.rst | 18 +-
doc/rest.rst | 2 +
doc/theming.rst | 4 +-
setup.py | 17 +-
sphinx/__init__.py | 6 +-
sphinx/addnodes.py | 8 +-
sphinx/application.py | 57 ++-
sphinx/builders/devhelp.py | 2 +-
sphinx/builders/gettext.py | 8 +-
sphinx/builders/latex.py | 2 +-
sphinx/config.py | 89 +++--
sphinx/directives/other.py | 1 +
sphinx/directives/patches.py | 4 +
sphinx/domains/cpp.py | 80 ++--
sphinx/domains/std.py | 5 +-
sphinx/environment.py | 44 ++-
sphinx/ext/autodoc.py | 19 +-
sphinx/ext/autosummary/__init__.py | 2 +-
sphinx/ext/imgmath.py | 16 +-
sphinx/ext/intersphinx.py | 21 +-
sphinx/ext/jsmath.py | 6 +-
sphinx/ext/mathbase.py | 46 ++-
sphinx/ext/mathjax.py | 13 +-
sphinx/ext/pngmath.py | 8 +-
sphinx/io.py | 20 +-
sphinx/locale/__init__.py | 9 +-
sphinx/quickstart.py | 225 ++++++-----
sphinx/search/__init__.py | 2 +-
sphinx/search/de.py | 1 -
sphinx/search/en.py | 1 -
sphinx/search/ja.py | 4 +-
sphinx/search/zh.py | 1 -
sphinx/texinputs/sphinx.sty | 420 +++++++++++++++------
sphinx/texinputs/sphinxhowto.cls | 17 +-
sphinx/texinputs/sphinxmanual.cls | 15 +-
sphinx/themes/basic/searchbox.html | 4 +-
sphinx/themes/basic/static/basic.css_t | 4 -
sphinx/theming.py | 3 +-
sphinx/transforms.py | 6 +-
sphinx/util/i18n.py | 3 +-
sphinx/util/texescape.py | 22 +-
sphinx/websupport/search/xapiansearch.py | 7 +-
sphinx/writers/html.py | 2 +-
sphinx/writers/latex.py | 96 +++--
sphinx/writers/texinfo.py | 2 +-
tests/root/contents.txt | 4 +
tests/root/markup.txt | 27 ++
tests/roots/test-correct-year/conf.py | 3 +
tests/roots/test-correct-year/contents.rst | 4 +
.../roots/test-image-glob/testima\314\210ge.png" | Bin 0 -> 67765 bytes
tests/roots/test-image-in-section/index.rst | 4 +
tests/roots/test-prolog/conf.py | 12 +
tests/roots/test-prolog/index.rst | 7 +
tests/roots/test-prolog/markdown.md | 3 +
tests/roots/test-prolog/prolog_markdown_parser.py | 12 +
tests/roots/test-prolog/restructuredtext.rst | 4 +
tests/test_application.py | 6 +
tests/test_build_html.py | 25 +-
tests/test_build_latex.py | 93 +++--
tests/test_build_texinfo.py | 2 +-
tests/test_correct_year.py | 49 +++
tests/test_environment.py | 2 +-
tests/test_ext_intersphinx.py | 17 +-
tests/test_ext_math.py | 18 +
tests/test_markup.py | 27 +-
tests/util.py | 4 +-
utils/release-checklist | 8 +-
74 files changed, 1345 insertions(+), 469 deletions(-)
diff --git a/CHANGES b/CHANGES
index 25506a1..2b7f4d0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,97 @@
+Release 1.4.3 (released Jun 5, 2016)
+====================================
+
+Bugs fixed
+----------
+
+* #2530: got "Counter too large" error on building PDF if large numbered footnotes existed in admonitions
+* ``width`` option of figure directive does not work if ``align`` option specified at same time (ref: #2595)
+* #2590: The ``inputenc`` package breaks compiling under lualatex and xelatex
+* #2540: date on latex front page use different font
+* Suppress "document isn't included in any toctree" warning if the document is included (ref: #2603)
+* #2614: Some tables in PDF output will end up shifted if user sets non zero \parindent in preamble
+* #2602: URL redirection breaks the hyperlinks generated by `sphinx.ext.intersphinx`
+* #2613: Show warnings if merged extensions are loaded
+* #2619: make sure amstext LaTeX package always loaded (ref: d657225, 488ee52, 9d82cad and #2615)
+* #2593: latex crashes if any figures in the table
+
+
+Release 1.4.2 (released May 29, 2016)
+=====================================
+
+Features added
+--------------
+
+* Now :confval:`suppress_warnings` accepts following configurations (ref: #2451, #2466):
+
+ - ``app.add_node``
+ - ``app.add_directive``
+ - ``app.add_role``
+ - ``app.add_generic_role``
+ - ``app.add_source_parser``
+ - ``image.data_uri``
+ - ``image.nonlocal_uri``
+
+* #2453: LaTeX writer allows page breaks in topic contents; and their
+ horizontal extent now fits in the line width (with shadow in margin). Also
+ warning-type admonitions allow page breaks and their vertical spacing has
+ been made more coherent with the one for hint-type notices (ref #2446).
+
+* #2459: the framing of literal code-blocks in LaTeX output (and not only the
+ code lines themselves) obey the indentation in lists or quoted blocks.
+
+* #2343: the long source lines in code-blocks are wrapped (without modifying
+ the line numbering) in LaTeX output (ref #1534, #2304).
+
+Bugs fixed
+----------
+
+* #2370: the equations are slightly misaligned in LaTeX writer
+* #1817, #2077: suppress pep8 warnings on conf.py generated by sphinx-quickstart
+* #2407: building docs crash if document includes large data image URIs
+* #2436: Sphinx does not check version by :confval:`needs_sphinx` if loading extensions failed
+* #2397: Setup shorthandoff for turkish documents
+* #2447: VerbatimBorderColor wrongly used also for captions of PDF
+* #2456: C++, fix crash related to document merging (e.g., singlehtml and Latex builders).
+* #2446: latex(pdf) sets local tables of contents (or more generally topic nodes) in unbreakable boxes, causes overflow at bottom
+* #2476: Omit MathJax markers if :nowrap: is given
+* #2465: latex builder fails in case no caption option is provided to toctree directive
+* Sphinx crashes if self referenced toctree found
+* #2481: spelling mistake for mecab search splitter. Thanks to Naoki Sato.
+* #2309: Fix could not refer "indirect hyperlink targets" by ref-role
+* intersphinx fails if mapping URL contains any port
+* #2088: intersphinx crashes if the mapping URL requires basic auth
+* #2304: auto line breaks in latexpdf codeblocks
+* #1534: Word wrap long lines in Latex verbatim blocks
+* #2460: too much white space on top of captioned literal blocks in PDF output
+* Show error reason when multiple math extensions are loaded (ref: #2499)
+* #2483: any figure number was not assigned if figure title contains only non text objects
+* #2501: Unicode subscript numbers are normalized in LaTeX
+* #2492: Figure directive with :figwidth: generates incorrect Latex-code
+* The caption of figure is always put on center even if ``:align:`` was specified
+* #2526: LaTeX writer crashes if the section having only images
+* #2522: Sphinx touches mo files under installed directory that caused permission error.
+* #2536: C++, fix crash when an immediately nested scope has the same name as the current scope.
+* #2555: Fix crash on any-references with unicode.
+* #2517: wrong bookmark encoding in PDF if using LuaLaTeX
+* #2521: generated Makefile causes BSD make crashed if sphinx-build not found
+* #2470: ``typing`` backport package causes autodoc errors with python 2.7
+* ``sphinx.ext.intersphinx`` crashes if non-string value is used for key of `intersphinx_mapping`
+* #2518: `intersphinx_mapping` disallows non alphanumeric keys
+* #2558: unpack error on devhelp builder
+* #2561: Info builder crashes when a footnote contains a link
+* #2565: The descriptions of objects generated by ``sphinx.ext.autosummary`` overflow lines at LaTeX writer
+* Extend pdflatex config in sphinx.sty to subparagraphs (ref: #2551)
+* #2445: `rst_prolog` and `rst_epilog` affect to non reST sources
+* #2576: ``sphinx.ext.imgmath`` crashes if subprocess raises error
+* #2577: ``sphinx.ext.imgmath``: Invalid argument are passed to dvisvgm
+* #2556: Xapian search does not work with Python 3
+* #2581: The search doesn't work if language="es" (spanish)
+* #2382: Adjust spacing after abbreviations on figure numbers in LaTeX writer
+* #2383: The generated footnote by `latex_show_urls` overflows lines
+* #2497, #2552: The label of search button does not fit for the button itself
+
+
Release 1.4.1 (released Apr 12, 2016)
=====================================
diff --git a/Makefile b/Makefile
index 0285484..3b95810 100644
--- a/Makefile
+++ b/Makefile
@@ -33,12 +33,15 @@ all: clean-pyc clean-backupfiles style-check test
style-check:
@$(PYTHON) utils/check_sources.py $(DONT_CHECK) .
-clean: clean-pyc clean-patchfiles clean-backupfiles clean-generated
+clean: clean-pyc clean-pycache clean-patchfiles clean-backupfiles clean-generated clean-testfiles
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
+clean-pycache:
+ find . -name __pycache__ -exec rm -rf {} +
+
clean-patchfiles:
find . -name '*.orig' -exec rm -f {} +
find . -name '*.rej' -exec rm -f {} +
@@ -50,6 +53,10 @@ clean-backupfiles:
clean-generated:
rm -f utils/*3.py*
+clean-testfiles:
+ rm -rf tests/build
+ rm -rf .tox/
+
pylint:
@pylint --rcfile utils/pylintrc sphinx
diff --git a/PKG-INFO b/PKG-INFO
index 8e23682..b2d718e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Sphinx
-Version: 1.4.1
+Version: 1.4.3
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
diff --git a/Sphinx.egg-info/PKG-INFO b/Sphinx.egg-info/PKG-INFO
index 8e23682..b2d718e 100644
--- a/Sphinx.egg-info/PKG-INFO
+++ b/Sphinx.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Sphinx
-Version: 1.4.1
+Version: 1.4.3
Summary: Python documentation generator
Home-page: http://sphinx-doc.org/
Author: Georg Brandl
diff --git a/Sphinx.egg-info/SOURCES.txt b/Sphinx.egg-info/SOURCES.txt
index 834447b..22cc247 100644
--- a/Sphinx.egg-info/SOURCES.txt
+++ b/Sphinx.egg-info/SOURCES.txt
@@ -545,6 +545,7 @@ tests/test_build_texinfo.py
tests/test_build_text.py
tests/test_catalogs.py
tests/test_config.py
+tests/test_correct_year.py
tests/test_directive_code.py
tests/test_directive_only.py
tests/test_docutilsconf.py
@@ -678,6 +679,8 @@ tests/roots/test-circular/conf.py
tests/roots/test-circular/contents.rst
tests/roots/test-circular/sub.rst
tests/roots/test-config/conf.py
+tests/roots/test-correct-year/conf.py
+tests/roots/test-correct-year/contents.rst
tests/roots/test-directive-code/caption.rst
tests/roots/test-directive-code/classes.rst
tests/roots/test-directive-code/conf.py
@@ -753,6 +756,7 @@ tests/roots/test-image-glob/index.rst
tests/roots/test-image-glob/rimg.png
tests/roots/test-image-glob/rimg.png.xx
tests/roots/test-image-glob/rimg.xx.png
+tests/roots/test-image-glob/testimäge.png
tests/roots/test-image-glob/subdir/index.rst
tests/roots/test-image-glob/subdir/rimg.png
tests/roots/test-image-glob/subdir/rimg.xx.png
@@ -824,6 +828,11 @@ tests/roots/test-numfig/conf.py
tests/roots/test-numfig/foo.rst
tests/roots/test-numfig/index.rst
tests/roots/test-numfig/rimg.png
+tests/roots/test-prolog/conf.py
+tests/roots/test-prolog/index.rst
+tests/roots/test-prolog/markdown.md
+tests/roots/test-prolog/prolog_markdown_parser.py
+tests/roots/test-prolog/restructuredtext.rst
tests/roots/test-setup/setup.cfg
tests/roots/test-setup/setup.py
tests/roots/test-setup/doc/conf.py
diff --git a/doc/config.rst b/doc/config.rst
index 9fc0869..dd978fe 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -218,6 +218,13 @@ General configuration
Sphinx supports following warning types:
+ * app.add_node
+ * app.add_directive
+ * app.add_role
+ * app.add_generic_role
+ * app.add_source_parser
+ * image.data_uri
+ * image.nonlocal_uri
* ref.term
* ref.ref
* ref.numref
@@ -276,7 +283,12 @@ General configuration
.. confval:: numfig
If true, figures, tables and code-blocks are automatically numbered if they
- have a caption. For now, it works only with the HTML builder. Default is ``False``.
+ have a caption. At same time, the `numref` role is enabled. For now, it
+ works only with the HTML builder and LaTeX builder. Default is ``False``.
+
+ .. note::
+
+ LaTeX builder always assign numbers whether this option is enabled or not.
.. versionadded:: 1.3
@@ -1608,8 +1620,13 @@ These options influence LaTeX output.
* Keys that don't need be overridden unless in special cases are:
``'inputenc'``
- "inputenc" package inclusion, default
- ``'\\usepackage[utf8]{inputenc}'``.
+ "inputenc" package inclusion, defaults to
+ ``'\\usepackage[utf8]{inputenc}'`` when using pdflatex.
+ Otherwise unset.
+
+ .. versionchanged:: 1.4.3
+ Previously ``'\\usepackage[utf8]{inputenc}'`` was used for all
+ compilers.
``'cmappkg'``
"cmap" package inclusion, default ``'\\usepackage{cmap}'``.
diff --git a/doc/devguide.rst b/doc/devguide.rst
index 313b026..b621f62 100644
--- a/doc/devguide.rst
+++ b/doc/devguide.rst
@@ -111,7 +111,7 @@ These are the basic steps needed to start developing on Sphinx.
* Run the unit tests::
- pip install nose mock
+ pip install -r test-reqs.txt
make test
* Build the documentation and check the output for different builders::
diff --git a/doc/ext/doctest.rst b/doc/ext/doctest.rst
index 9b1b4e6..2d06b69 100644
--- a/doc/ext/doctest.rst
+++ b/doc/ext/doctest.rst
@@ -33,11 +33,14 @@ There are two kinds of test blocks:
* *code-output-style* blocks consist of an ordinary piece of Python code, and
optionally, a piece of output for that code.
-The doctest extension provides four directives. The *group* argument is
-interpreted as follows: if it is empty, the block is assigned to the group named
-``default``. If it is ``*``, the block is assigned to all groups (including the
-``default`` group). Otherwise, it must be a comma-separated list of group
-names.
+
+Directives
+----------
+
+The *group* argument below is interpreted as follows: if it is empty, the block
+is assigned to the group named ``default``. If it is ``*``, the block is
+assigned to all groups (including the ``default`` group). Otherwise, it must be
+a comma-separated list of group names.
.. rst:directive:: .. testsetup:: [group]
@@ -174,7 +177,10 @@ The following is an example for the usage of the directives. The test via
This parrot wouldn't voom if you put 3000 volts through it!
-There are also these config values for customizing the doctest extension:
+Configuration
+-------------
+
+The doctest extension uses the following configuration values:
.. confval:: doctest_path
diff --git a/doc/rest.rst b/doc/rest.rst
index 9fca31b..293b2ea 100644
--- a/doc/rest.rst
+++ b/doc/rest.rst
@@ -196,6 +196,8 @@ Use ```Link text <http://example.com/>`_`` for inline web links. If the link
text should be the web address, you don't need special markup at all, the parser
finds links and mail addresses in ordinary text.
+.. important:: There must be a space between the link text and the opening \< for the URL.
+
You can also separate the link and the target definition (:duref:`ref
<hyperlink-targets>`), like this::
diff --git a/doc/theming.rst b/doc/theming.rst
index c003c79..f124542 100644
--- a/doc/theming.rst
+++ b/doc/theming.rst
@@ -51,7 +51,7 @@ The third form provides your theme path dynamically to Sphinx if the
called ``sphinx_themes`` in your setup.py file and write a ``get_path`` function
that has to return the directory with themes in it::
- // in your 'setup.py'
+ # 'setup.py'
setup(
...
@@ -63,7 +63,7 @@ that has to return the directory with themes in it::
...
)
- // in 'your_package.py'
+ # 'your_package.py'
from os import path
package_dir = path.abspath(path.dirname(__file__))
diff --git a/setup.py b/setup.py
index 8c10f1f..a35c769 100644
--- a/setup.py
+++ b/setup.py
@@ -97,6 +97,13 @@ else:
def run(self):
compile_catalog.run(self)
+ if isinstance(self.domain, list):
+ for domain in self.domain:
+ self._run_domain_js(domain)
+ else:
+ self._run_domain_js(self.domain)
+
+ def _run_domain_js(self, domain):
po_files = []
js_files = []
@@ -105,20 +112,20 @@ else:
po_files.append((self.locale,
os.path.join(self.directory, self.locale,
'LC_MESSAGES',
- self.domain + '.po')))
+ domain + '.po')))
js_files.append(os.path.join(self.directory, self.locale,
'LC_MESSAGES',
- self.domain + '.js'))
+ domain + '.js'))
else:
for locale in os.listdir(self.directory):
po_file = os.path.join(self.directory, locale,
'LC_MESSAGES',
- self.domain + '.po')
+ domain + '.po')
if os.path.exists(po_file):
po_files.append((locale, po_file))
js_files.append(os.path.join(self.directory, locale,
'LC_MESSAGES',
- self.domain + '.js'))
+ domain + '.js'))
else:
po_files.append((self.locale, self.input_file))
if self.output_file:
@@ -126,7 +133,7 @@ else:
else:
js_files.append(os.path.join(self.directory, self.locale,
'LC_MESSAGES',
- self.domain + '.js'))
+ domain + '.js'))
for js_file, (locale, po_file) in zip(js_files, po_files):
infile = open(po_file, 'r')
diff --git a/sphinx/__init__.py b/sphinx/__init__.py
index 16ec7a4..7203fde 100644
--- a/sphinx/__init__.py
+++ b/sphinx/__init__.py
@@ -15,13 +15,13 @@
import sys
from os import path
-__version__ = '1.4.1'
-__released__ = '1.4.1' # used when Sphinx builds its own docs
+__version__ = '1.4.3'
+__released__ = '1.4.3' # used when Sphinx builds its own docs
# version info for better programmatic use
# possible values for 3rd element: 'alpha', 'beta', 'rc', 'final'
# 'final' has 0 as the last element
-version_info = (1, 4, 1, 'final', 0)
+version_info = (1, 4, 3, 'final', 0)
package_dir = path.abspath(path.dirname(__file__))
diff --git a/sphinx/addnodes.py b/sphinx/addnodes.py
index 026770f..284bc1c 100644
--- a/sphinx/addnodes.py
+++ b/sphinx/addnodes.py
@@ -116,10 +116,14 @@ class index(nodes.Invisible, nodes.Inline, nodes.TextElement):
"""Node for index entries.
This node is created by the ``index`` directive and has one attribute,
- ``entries``. Its value is a list of 4-tuples of ``(entrytype, entryname,
- target, ignored)``.
+ ``entries``. Its value is a list of 5-tuples of ``(entrytype, entryname,
+ target, ignored, key)``.
*entrytype* is one of "single", "pair", "double", "triple".
+
+ *key* is categolziation characters (usually it is single character) for
+ general index page. For the detail of this, please see also:
+ :rst:dir:`glossary` and issue #2320.
"""
diff --git a/sphinx/application.py b/sphinx/application.py
index 9ff99b6..6bb35a0 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -44,6 +44,7 @@ from sphinx.util.osutil import ENOENT
from sphinx.util.logging import is_suppressed_warning
from sphinx.util.console import bold, lightgray, darkgray, darkgreen, \
term_width_line
+from sphinx.util.i18n import find_catalog_source_files
if hasattr(sys, 'intern'):
intern = sys.intern
@@ -68,6 +69,10 @@ events = {
CONFIG_FILENAME = 'conf.py'
ENV_PICKLE_FILENAME = 'environment.pickle'
+# list of deprecated extensions. Keys are extension name.
+# Values are Sphinx version that merge the extension.
+EXTENSION_BLACKLIST = {"sphinxjp.themecore": "1.2"}
+
class Sphinx(object):
@@ -133,6 +138,15 @@ class Sphinx(object):
self.config.check_unicode(self.warn)
# defer checking types until i18n has been initialized
+ # initialize some limited config variables before loading extensions
+ self.config.pre_init_values(self.warn)
+
+ # check the Sphinx version if requested
+ if self.config.needs_sphinx and self.config.needs_sphinx > sphinx.__display_version__:
+ raise VersionRequirementError(
+ 'This project needs at least Sphinx v%s and therefore cannot '
+ 'be built with this version.' % self.config.needs_sphinx)
+
# set confdir to srcdir if -C given (!= no confdir); a few pieces
# of code expect a confdir to be set
if self.confdir is None:
@@ -163,13 +177,6 @@ class Sphinx(object):
# now that we know all config values, collect them from conf.py
self.config.init_values(self.warn)
- # check the Sphinx version if requested
- if self.config.needs_sphinx and \
- self.config.needs_sphinx > sphinx.__display_version__:
- raise VersionRequirementError(
- 'This project needs at least Sphinx v%s and therefore cannot '
- 'be built with this version.' % self.config.needs_sphinx)
-
# check extension versions if requested
if self.config.needs_extensions:
for extname, needs_ver in self.config.needs_extensions.items():
@@ -205,13 +212,17 @@ class Sphinx(object):
if self.config.language is not None:
self.info(bold('loading translations [%s]... ' %
self.config.language), nonl=True)
- locale_dirs = [None, path.join(package_dir, 'locale')] + \
- [path.join(self.srcdir, x) for x in self.config.locale_dirs]
+ user_locale_dirs = [
+ path.join(self.srcdir, x) for x in self.config.locale_dirs]
+ # compile mo files if sphinx.po file in user locale directories are updated
+ for catinfo in find_catalog_source_files(
+ user_locale_dirs, self.config.language, domains=['sphinx'],
+ charset=self.config.source_encoding):
+ catinfo.write_mo(self.config.language)
+ locale_dirs = [None, path.join(package_dir, 'locale')] + user_locale_dirs
else:
locale_dirs = []
- self.translator, has_translation = locale.init(locale_dirs,
- self.config.language,
- charset=self.config.source_encoding)
+ self.translator, has_translation = locale.init(locale_dirs, self.config.language)
if self.config.language is not None:
if has_translation or self.config.language == 'en':
# "en" never needs to be translated
@@ -453,6 +464,11 @@ class Sphinx(object):
self.debug('[app] setting up extension: %r', extension)
if extension in self._extensions:
return
+ if extension in EXTENSION_BLACKLIST:
+ self.warn('the extension %r was already merged with Sphinx since version %s; '
+ 'this extension is ignored.' % (
+ extension, EXTENSION_BLACKLIST[extension]))
+ return
self._setting_up_extension.append(extension)
try:
mod = __import__(extension, None, None, ['setup'])
@@ -584,7 +600,8 @@ class Sphinx(object):
hasattr(nodes.GenericNodeVisitor, 'visit_' + node.__name__):
self.warn('while setting up extension %s: node class %r is '
'already registered, its visitors will be overridden' %
- (self._setting_up_extension, node.__name__))
+ (self._setting_up_extension, node.__name__),
+ type='app', subtype='add_node')
nodes._add_node_class_names([node.__name__])
for key, val in iteritems(kwds):
try:
@@ -636,7 +653,8 @@ class Sphinx(object):
if name in directives._directives:
self.warn('while setting up extension %s: directive %r is '
'already registered, it will be overridden' %
- (self._setting_up_extension[-1], name))
+ (self._setting_up_extension[-1], name),
+ type='app', subtype='add_directive')
directives.register_directive(
name, self._directive_helper(obj, content, arguments, **options))
@@ -645,7 +663,8 @@ class Sphinx(object):
if name in roles._roles:
self.warn('while setting up extension %s: role %r is '
'already registered, it will be overridden' %
- (self._setting_up_extension[-1], name))
+ (self._setting_up_extension[-1], name),
+ type='app', subtype='add_role')
roles.register_local_role(name, role)
def add_generic_role(self, name, nodeclass):
@@ -655,7 +674,8 @@ class Sphinx(object):
if name in roles._roles:
self.warn('while setting up extension %s: role %r is '
'already registered, it will be overridden' %
- (self._setting_up_extension[-1], name))
+ (self._setting_up_extension[-1], name),
+ type='app', subtype='add_generic_role')
role = roles.GenericRole(name, nodeclass)
roles.register_local_role(name, role)
@@ -782,6 +802,11 @@ class Sphinx(object):
def add_source_parser(self, suffix, parser):
self.debug('[app] adding search source_parser: %r, %r', (suffix, parser))
+ if suffix in self._additional_source_parsers:
+ self.warn('while setting up extension %s: source_parser for %r is '
+ 'already registered, it will be overridden' %
+ (self._setting_up_extension[-1], suffix),
+ type='app', subtype='add_source_parser')
self._additional_source_parsers[suffix] = parser
diff --git a/sphinx/builders/devhelp.py b/sphinx/builders/devhelp.py
index 5ebaf2d..62e2c98 100644
--- a/sphinx/builders/devhelp.py
+++ b/sphinx/builders/devhelp.py
@@ -123,7 +123,7 @@ class DevhelpBuilder(StandaloneHTMLBuilder):
subitem[1], [])
for (key, group) in index:
- for title, (refs, subitems) in group:
+ for title, (refs, subitems, key) in group:
write_index(title, refs, subitems)
# Dump the XML file
diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py
index fce6c8c..1c47893 100644
--- a/sphinx/builders/gettext.py
+++ b/sphinx/builders/gettext.py
@@ -11,7 +11,7 @@
from __future__ import unicode_literals
-from os import path, walk
+from os import path, walk, getenv
from codecs import open
from time import time
from datetime import datetime, tzinfo, timedelta
@@ -130,6 +130,12 @@ class I18nBuilder(Builder):
timestamp = time()
tzdelta = datetime.fromtimestamp(timestamp) - \
datetime.utcfromtimestamp(timestamp)
+# set timestamp from SOURCE_DATE_EPOCH if set
+# see https://reproducible-builds.org/specs/source-date-epoch/
+source_date_epoch = getenv('SOURCE_DATE_EPOCH')
+if source_date_epoch is not None:
+ timestamp = float(source_date_epoch)
+ tzdelta = 0
class LocalTimeZone(tzinfo):
diff --git a/sphinx/builders/latex.py b/sphinx/builders/latex.py
index f3e64bc..ac26e33 100644
--- a/sphinx/builders/latex.py
+++ b/sphinx/builders/latex.py
@@ -137,7 +137,7 @@ class LaTeXBuilder(Builder):
tree = self.env.get_doctree(indexfile)
contentsname = None
for toctree in tree.traverse(addnodes.toctree):
- if toctree['caption']:
+ if 'caption' in toctree:
contentsname = toctree['caption']
break
diff --git a/sphinx/config.py b/sphinx/config.py
index e199e7d..9cbf655 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -10,7 +10,7 @@
"""
import re
-from os import path, environ
+from os import path, environ, getenv
import shlex
from six import PY2, PY3, iteritems, string_types, binary_type, text_type, integer_types
@@ -19,8 +19,10 @@ from sphinx.errors import ConfigError
from sphinx.locale import l_
from sphinx.util.osutil import make_filename, cd
from sphinx.util.pycompat import execfile_, NoneType
+from sphinx.util.i18n import format_date
nonascii_re = re.compile(br'[\x80-\xff]')
+copyright_year_re = re.compile(r'^((\d{4}-)?)(\d{4})(?=[ ,])')
CONFIG_SYNTAX_ERROR = "There is a syntax error in your configuration file: %s"
if PY3:
@@ -298,6 +300,15 @@ class Config(object):
self.setup = config.get('setup', None)
self.extensions = config.get('extensions', [])
+ # correct values of copyright year that are not coherent with
+ # the SOURCE_DATE_EPOCH environment variable (if set)
+ # See https://reproducible-builds.org/specs/source-date-epoch/
+ if getenv('SOURCE_DATE_EPOCH') is not None:
+ for k in ('copyright', 'epub_copyright'):
+ if k in config:
+ config[k] = copyright_year_re.sub('\g<1>%s' % format_date('%Y'),
+ config[k])
+
def check_types(self, warn):
# check all values for deviation from the default value's type, since
# that can result in TypeErrors all over the place
@@ -338,40 +349,60 @@ class Config(object):
'characters; this can lead to Unicode errors occurring. '
'Please use Unicode strings, e.g. %r.' % (name, u'Content'))
+ def convert_overrides(self, name, value):
+ if not isinstance(value, string_types):
+ return value
+ else:
+ defvalue = self.values[name][0]
+ if isinstance(defvalue, dict):
+ raise ValueError('cannot override dictionary config setting %r, '
+ 'ignoring (use %r to set individual elements)' %
+ (name, name + '.key=value'))
+ elif isinstance(defvalue, list):
+ return value.split(',')
+ elif isinstance(defvalue, integer_types):
+ try:
+ return int(value)
+ except ValueError:
+ raise ValueError('invalid number %r for config value %r, ignoring' %
+ (value, name))
+ elif hasattr(defvalue, '__call__'):
+ return value
+ elif defvalue is not None and not isinstance(defvalue, string_types):
+ raise ValueError('cannot override config setting %r with unsupported '
+ 'type, ignoring' % name)
+ else:
+ return value
+
+ def pre_init_values(self, warn):
+ """Initialize some limited config variables before loading extensions"""
+ variables = ['needs_sphinx', 'suppress_warnings']
+ for name in variables:
+ try:
+ if name in self.overrides:
+ self.__dict__[name] = self.convert_overrides(name, self.overrides[name])
+ elif name in self._raw_config:
+ self.__dict__[name] = self._raw_config[name]
+ except ValueError as exc:
+ warn(exc)
+
def init_values(self, warn):
config = self._raw_config
for valname, value in iteritems(self.overrides):
- if '.' in valname:
- realvalname, key = valname.split('.', 1)
- config.setdefault(realvalname, {})[key] = value
- continue
- elif valname not in self.values:
- warn('unknown config value %r in override, ignoring' % valname)
- continue
- defvalue = self.values[valname][0]
- if isinstance(value, string_types):
- if isinstance(defvalue, dict):
- warn('cannot override dictionary config setting %r, '
- 'ignoring (use %r to set individual elements)' %
- (valname, valname + '.key=value'))
+ try:
+ if '.' in valname:
+ realvalname, key = valname.split('.', 1)
+ config.setdefault(realvalname, {})[key] = value
continue
- elif isinstance(defvalue, list):
- config[valname] = value.split(',')
- elif isinstance(defvalue, integer_types):
- try:
- config[valname] = int(value)
- except ValueError:
- warn('invalid number %r for config value %r, ignoring'
- % (value, valname))
- elif hasattr(defvalue, '__call__'):
- config[valname] = value
- elif defvalue is not None and not isinstance(defvalue, string_types):
- warn('cannot override config setting %r with unsupported '
- 'type, ignoring' % valname)
+ elif valname not in self.values:
+ warn('unknown config value %r in override, ignoring' % valname)
+ continue
+ if isinstance(value, string_types):
+ config[valname] = self.convert_overrides(valname, value)
else:
config[valname] = value
- else:
- config[valname] = value
+ except ValueError as exc:
+ warn(exc)
for name in config:
if name in self.values:
self.__dict__[name] = config[name]
diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py
index 5129457..bab2f9f 100644
--- a/sphinx/directives/other.py
+++ b/sphinx/directives/other.py
@@ -405,6 +405,7 @@ class Include(BaseInclude):
return BaseInclude.run(self)
rel_filename, filename = env.relfn2path(self.arguments[0])
self.arguments[0] = filename
+ env.note_included(filename)
return BaseInclude.run(self)
diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py
index dcdc41a..4f6f372 100644
--- a/sphinx/directives/patches.py
+++ b/sphinx/directives/patches.py
@@ -28,6 +28,10 @@ class Figure(images.Figure):
self.options['name'] = name
self.add_name(figure_node)
+ # fill lineno using image node
+ if figure_node.line is None and len(figure_node) == 2:
+ figure_node.line = figure_node[1].line
+
return [figure_node]
diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py
index 6847d5a..7d41d65 100644
--- a/sphinx/domains/cpp.py
+++ b/sphinx/domains/cpp.py
@@ -572,7 +572,7 @@ class ASTIdentifier(ASTBase):
classname=None)
key = symbol.get_lookup_key()
assert key
- pnode['cpp:parentKey'] = key
+ pnode['cpp:parent_key'] = key
pnode += nodes.Text(self.identifier)
signode += pnode
elif mode == 'lastIsName':
@@ -2587,7 +2587,7 @@ class Symbol(object):
s = s._find_named_symbol(identifier, templateParams,
templateArgs, operator,
templateShorthand=False,
- matchSelf=True)
+ matchSelf=False)
if not s:
return None
return s
@@ -3768,10 +3768,10 @@ class CPPObject(ObjectDescription):
raise NotImplementedError()
def handle_signature(self, sig, signode):
- if 'cpp:parentSymbol' not in self.env.ref_context:
- root = self.env.domaindata['cpp']['rootSymbol']
- self.env.ref_context['cpp:parentSymbol'] = root
- parentSymbol = self.env.ref_context['cpp:parentSymbol']
+ if 'cpp:parent_symbol' not in self.env.ref_context:
+ root = self.env.domaindata['cpp']['root_symbol']
+ self.env.ref_context['cpp:parent_symbol'] = root
+ parentSymbol = self.env.ref_context['cpp:parent_symbol']
parser = DefinitionParser(sig, self)
try:
@@ -3783,16 +3783,16 @@ class CPPObject(ObjectDescription):
# the possibly inner declarations.
name = _make_phony_error_name()
symbol = parentSymbol.add_name(name)
- self.env.ref_context['cpp:lastSymbol'] = symbol
+ self.env.ref_context['cpp:last_symbol'] = symbol
raise ValueError
try:
symbol = parentSymbol.add_declaration(ast, docname=self.env.docname)
- self.env.ref_context['cpp:lastSymbol'] = symbol
+ self.env.ref_context['cpp:last_symbol'] = symbol
except _DuplicateSymbolError as e:
# Assume we are actually in the old symbol,
# instead of the newly created duplicate.
- self.env.ref_context['cpp:lastSymbol'] = e.symbol
+ self.env.ref_context['cpp:last_symbol'] = e.symbol
if ast.objectType == 'enumerator':
self._add_enumerator_to_parent(ast)
@@ -3839,13 +3839,13 @@ class CPPClassObject(CPPObject):
return _('%s (C++ class)') % name
def before_content(self):
- lastSymbol = self.env.ref_context['cpp:lastSymbol']
+ lastSymbol = self.env.ref_context['cpp:last_symbol']
assert lastSymbol
- self.oldParentSymbol = self.env.ref_context['cpp:parentSymbol']
- self.env.ref_context['cpp:parentSymbol'] = lastSymbol
+ self.oldParentSymbol = self.env.ref_context['cpp:parent_symbol']
+ self.env.ref_context['cpp:parent_symbol'] = lastSymbol
def after_content(self):
- self.env.ref_context['cpp:parentSymbol'] = self.oldParentSymbol
+ self.env.ref_context['cpp:parent_symbol'] = self.oldParentSymbol
def parse_definition(self, parser):
return parser.parse_declaration("class")
@@ -3859,13 +3859,13 @@ class CPPEnumObject(CPPObject):
return _('%s (C++ enum)') % name
def before_content(self):
- lastSymbol = self.env.ref_context['cpp:lastSymbol']
+ lastSymbol = self.env.ref_context['cpp:last_symbol']
assert lastSymbol
- self.oldParentSymbol = self.env.ref_context['cpp:parentSymbol']
- self.env.ref_context['cpp:parentSymbol'] = lastSymbol
+ self.oldParentSymbol = self.env.ref_context['cpp:parent_symbol']
+ self.env.ref_context['cpp:parent_symbol'] = lastSymbol
def after_content(self):
- self.env.ref_context['cpp:parentSymbol'] = self.oldParentSymbol
+ self.env.ref_context['cpp:parent_symbol'] = self.oldParentSymbol
def parse_definition(self, parser):
ast = parser.parse_declaration("enum")
@@ -3912,7 +3912,7 @@ class CPPNamespaceObject(Directive):
def run(self):
env = self.state.document.settings.env
- rootSymbol = env.domaindata['cpp']['rootSymbol']
+ rootSymbol = env.domaindata['cpp']['root_symbol']
if self.arguments[0].strip() in ('NULL', '0', 'nullptr'):
symbol = rootSymbol
stack = []
@@ -3927,8 +3927,8 @@ class CPPNamespaceObject(Directive):
ast = ASTNamespace(name, None)
symbol = rootSymbol.add_name(ast.nestedName, ast.templatePrefix)
stack = [symbol]
- env.ref_context['cpp:parentSymbol'] = symbol
- env.temp_data['cpp:namespaceStack'] = stack
+ env.ref_context['cpp:parent_symbol'] = symbol
+ env.temp_data['cpp:namespace_stack'] = stack
return []
@@ -3954,14 +3954,14 @@ class CPPNamespacePushObject(Directive):
self.warn(e.description)
name = _make_phony_error_name()
ast = ASTNamespace(name, None)
- oldParent = env.ref_context.get('cpp:parentSymbol', None)
+ oldParent = env.ref_context.get('cpp:parent_symbol', None)
if not oldParent:
- oldParent = env.domaindata['cpp']['rootSymbol']
+ oldParent = env.domaindata['cpp']['root_symbol']
symbol = oldParent.add_name(ast.nestedName, ast.templatePrefix)
- stack = env.temp_data.get('cpp:namespaceStack', [])
+ stack = env.temp_data.get('cpp:namespace_stack', [])
stack.append(symbol)
- env.ref_context['cpp:parentSymbol'] = symbol
- env.temp_data['cpp:namespaceStack'] = stack
+ env.ref_context['cpp:parent_symbol'] = symbol
+ env.temp_data['cpp:namespace_stack'] = stack
return []
@@ -3977,7 +3977,7 @@ class CPPNamespacePopObject(Directive):
def run(self):
env = self.state.document.settings.env
- stack = env.temp_data.get('cpp:namespaceStack', None)
+ stack = env.temp_data.get('cpp:namespace_stack', None)
if not stack or len(stack) == 0:
self.warn("C++ namespace pop on empty stack. Defaulting to gobal scope.")
stack = []
@@ -3986,17 +3986,17 @@ class CPPNamespacePopObject(Directive):
if len(stack) > 0:
symbol = stack[-1]
... 2786 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sphinx.git
More information about the Python-modules-commits
mailing list