Merge branch 'stable'

This commit is contained in:
Takeshi KOMIYA 2017-05-26 00:15:00 +09:00
commit ca6a1edd2f
15 changed files with 125 additions and 88 deletions

17
CHANGES
View File

@ -59,6 +59,8 @@ Release 1.6.2 (in development)
Incompatible changes
--------------------
* #3789: Do not require typing module for python>=3.5
Deprecated
----------
@ -72,6 +74,21 @@ Bugs fixed
* #3756: epub: Entity 'mdash' not defined
* #3758: Sphinx crashed if logs are emitted in conf.py
* #3755: incorrectly warns about dedent with literalinclude
* #3742: `RTD <https://readthedocs.org/>`_ PDF builds of Sphinx own docs are
missing an index entry in the bookmarks and table of contents. This is
`rtfd/readthedocs.org#2857
<https://github.com/rtfd/readthedocs.org/issues/2857>`_ issue, a workaround
is obtained using some extra LaTeX code in Sphinx's own :file:`conf.py`
* #3770: Build fails when a "code-block" has the option emphasize-lines and the
number indicated is higher than the number of lines
* #3774: Incremental HTML building broken when using citations
* #3772: 'str object' has no attribute 'filename'
* #3763: got epubcheck validations error if epub_cover is set
* #3779: 'ImportError' in sphinx.ext.autodoc due to broken 'sys.meta_path'.
Thanks to Tatiana Tereshchenko.
* #3796: env.resolve_references() crashes when non-document node given
* #3803: Sphinx crashes with invalid PO files
* #3791: PDF "continued on next page" for long tables isn't internationalized
Testing
--------

View File

@ -7,6 +7,13 @@
[python: **.py]
encoding = utf-8
# Extraction from Jinja2 template files
[jinja2: **/templates/latex/**.tex_t]
variable_start_string = <%=
variable_end_string = %>
block_start_string = <%
block_end_string = %>
# Extraction from Jinja2 HTML templates
[jinja2: **/themes/**.html]
encoding = utf-8

View File

@ -56,7 +56,12 @@ latex_logo = '_static/sphinx.png'
latex_elements = {
'fontpkg': '\\usepackage{palatino}',
'passoptionstopackages': '\\PassOptionsToPackage{svgnames}{xcolor}',
'printindex': '\\footnotesize\\raggedright\\printindex',
# fix missing index entry due to RTD doing only once pdflatex after makeindex
'printindex': r'''
\IfFileExists{\jobname.ind}
{\footnotesize\raggedright\printindex}
{\begin{sphinxtheindex}\end{sphinxtheindex}}
''',
}
latex_show_urls = 'footnote'

View File

@ -60,6 +60,9 @@ extras_require = {
':sys_platform=="win32"': [
'colorama>=0.3.5',
],
':python_version<"3.5"': [
'typing'
],
'websupport': [
'sqlalchemy>=0.9',
'whoosh>=2.0',
@ -77,6 +80,9 @@ extras_require = {
if sys.platform == 'win32':
requires.append('colorama>=0.3.5')
if sys.version_info < (3, 5):
requires.append('typing')
# Provide a "compile_catalog" command that also creates the translated
# JavaScript files if Babel is available.

View File

@ -568,8 +568,8 @@ class EpubBuilder(StandaloneHTMLBuilder):
if self.coverpage_name not in self.files:
ext = path.splitext(self.coverpage_name)[-1]
self.files.append(self.coverpage_name)
item = ManifestItem(self.esc(filename),
self.esc(self.make_id(filename)),
item = ManifestItem(self.esc(self.coverpage_name),
self.esc(self.make_id(self.coverpage_name)),
self.esc(self.media_types[ext]))
metadata['manifest_items'].append(item)
ctx = {'image': self.esc(image), 'title': self.config.project}

View File

@ -127,7 +127,7 @@ class CodeBlock(Directive):
hl_lines = parselinenos(linespec, nlines)
if any(i >= nlines for i in hl_lines):
logger.warning('line number spec is out of range(1-%d): %r' %
(nlines, self.options['emphasize_lines']),
(nlines, self.options['emphasize-lines']),
location=location)
hl_lines = [x + 1 for x in hl_lines if x < nlines]
@ -441,7 +441,7 @@ class LiteralInclude(Directive):
hl_lines = parselinenos(self.options['emphasize-lines'], lines)
if any(i >= lines for i in hl_lines):
logger.warning('line number spec is out of range(1-%d): %r' %
(lines, self.options['emphasize_lines']),
(lines, self.options['emphasize-lines']),
location=location)
extra_args['hl_lines'] = [x + 1 for x in hl_lines if x < lines]
extra_args['linenostart'] = reader.lineno_start

View File

@ -538,7 +538,7 @@ class StandardDomain(Domain):
if docnames == [docname]:
del self.data['citation_refs'][key]
elif docname in docnames:
docnames.pop(docname)
docnames.remove(docname)
for key, (fn, _l, _l) in list(self.data['labels'].items()):
if fn == docname:
del self.data['labels'][key]

View File

@ -35,11 +35,11 @@ from sphinx import addnodes
from sphinx.io import SphinxStandaloneReader, SphinxDummyWriter, SphinxFileInput
from sphinx.util import logging
from sphinx.util import get_matching_docs, FilenameUniqDict, status_iterator
from sphinx.util.nodes import WarningStream, is_translatable
from sphinx.util.nodes import is_translatable
from sphinx.util.osutil import SEP, ensuredir
from sphinx.util.i18n import find_catalog_files
from sphinx.util.console import bold # type: ignore
from sphinx.util.docutils import sphinx_domains
from sphinx.util.docutils import sphinx_domains, WarningStream
from sphinx.util.matching import compile_matchers
from sphinx.util.parallel import ParallelTasks, parallel_available, make_chunks
from sphinx.util.websupport import is_commentable
@ -863,8 +863,7 @@ class BuildEnvironment(object):
with open(doctree_filename, 'rb') as f:
doctree = pickle.load(f)
doctree.settings.env = self
doctree.reporter = Reporter(self.doc2path(docname), 2, 5,
stream=WarningStream(self._warnfunc))
doctree.reporter = Reporter(self.doc2path(docname), 2, 5, stream=WarningStream())
return doctree
def get_and_resolve_doctree(self, docname, builder, doctree=None,
@ -919,10 +918,9 @@ class BuildEnvironment(object):
try:
# set env.docname during applying post-transforms
self.temp_data['docname'] = docname
if hasattr(doctree, 'settings'):
doctree.settings.env = self
transformer = SphinxTransformer(doctree)
transformer.set_environment(self)
transformer.add_transforms(self.app.post_transforms)
transformer.apply_transforms()
finally:

View File

@ -171,13 +171,12 @@ class _MockImporter(object):
# set(['a', 'd'])
self.base_packages.add(n.split('.')[0])
self.mocked_modules = [] # type: List[str]
self.orig_meta_path = sys.meta_path
# enable hook by adding itself to meta_path
sys.meta_path = sys.meta_path + [self]
def disable(self):
# restore original meta_path to disable import hook
sys.meta_path = self.orig_meta_path
# remove `self` from `sys.meta_path` to disable import hook
sys.meta_path = [i for i in sys.meta_path if i is not self]
# remove mocked modules from sys.modules to avoid side effects after
# running auto-documenter
for m in self.mocked_modules:

View File

@ -6,16 +6,16 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Sphinx 1.6\n"
"Project-Id-Version: Sphinx 1.6.2\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2017-04-28 15:54+0000\n"
"POT-Creation-Date: 2017-05-25 11:17+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
"Generated-By: Babel 2.4.0\n"
#: sphinx/application.py:181
#, python-format
@ -26,9 +26,9 @@ msgstr ""
#: sphinx/application.py:208
msgid ""
"'setup' that is specified in the conf.py has not been callable. Please "
"provide a callable `setup` function in order to behave as a sphinx "
"extension conf.py itself."
"'setup' as currently defined in conf.py isn't a Python callable. Please "
"modify its definition to make it a callable function. This is needed for "
"conf.py to behave as a Sphinx extension."
msgstr ""
#: sphinx/application.py:222
@ -82,7 +82,7 @@ msgstr ""
#: sphinx/application.py:518
#, python-format
msgid "A Translator for the %s builder is changed."
msgid "Change of translator for the %s builder."
msgstr ""
#: sphinx/application.py:526
@ -158,12 +158,12 @@ msgstr ""
msgid "No such config value: %s"
msgstr ""
#: sphinx/events.py:56
#: sphinx/events.py:57
#, python-format
msgid "Event %r already present"
msgstr ""
#: sphinx/events.py:62
#: sphinx/events.py:63
#, python-format
msgid "Unknown event name: %s"
msgstr ""
@ -171,11 +171,11 @@ msgstr ""
#: sphinx/extension.py:53
#, python-format
msgid ""
"needs_extensions config value specifies a version requirement for "
"extension %s, but it is not loaded"
"The %s extension is required by needs_extensions settings,but it is not "
"loaded."
msgstr ""
#: sphinx/extension.py:59
#: sphinx/extension.py:58
#, python-format
msgid ""
"This project needs the extension %s at least in version %s and therefore "
@ -287,7 +287,7 @@ msgstr ""
#: sphinx/theming.py:237
#, python-format
msgid "Theme extension %r does not response correctly."
msgid "Theme extension %r does not respond correctly."
msgstr ""
#: sphinx/theming.py:264
@ -314,30 +314,30 @@ msgstr ""
msgid "Module level"
msgstr ""
#: sphinx/builders/html.py:357 sphinx/transforms/__init__.py:119
#: sphinx/builders/html.py:397 sphinx/transforms/__init__.py:122
#: sphinx/writers/latex.py:561 sphinx/writers/manpage.py:110
#: sphinx/writers/texinfo.py:241
#, python-format
msgid "%b %d, %Y"
msgstr ""
#: sphinx/builders/html.py:377 sphinx/themes/basic/defindex.html:30
#: sphinx/builders/html.py:415 sphinx/themes/basic/defindex.html:30
msgid "General Index"
msgstr ""
#: sphinx/builders/html.py:377
#: sphinx/builders/html.py:415
msgid "index"
msgstr ""
#: sphinx/builders/html.py:441
#: sphinx/builders/html.py:479
msgid "next"
msgstr ""
#: sphinx/builders/html.py:450
#: sphinx/builders/html.py:488
msgid "previous"
msgstr ""
#: sphinx/builders/html.py:1313
#: sphinx/builders/html.py:1351
#, python-format
msgid "%s %s documentation"
msgstr ""
@ -360,28 +360,28 @@ msgstr ""
msgid "Cannot use both \"%s\" and \"%s\" options"
msgstr ""
#: sphinx/directives/code.py:218
#: sphinx/directives/code.py:214
#, python-format
msgid "Include file %r not found or reading it failed"
msgstr ""
#: sphinx/directives/code.py:220
#: sphinx/directives/code.py:216
#, python-format
msgid ""
"Encoding %r used for reading included file %r seems to be wrong, try "
"giving an :encoding: option"
msgstr ""
#: sphinx/directives/code.py:257
#: sphinx/directives/code.py:254
#, python-format
msgid "Object named %r not found in include file %r"
msgstr ""
#: sphinx/directives/code.py:283
#: sphinx/directives/code.py:280
msgid "Cannot use \"lineno-match\" with a disjoint set of \"lines\""
msgstr ""
#: sphinx/directives/code.py:288
#: sphinx/directives/code.py:285
#, python-format
msgid "Line spec %r: no lines pulled from include file %r"
msgstr ""
@ -402,7 +402,7 @@ msgstr ""
msgid "Author: "
msgstr ""
#: sphinx/domains/__init__.py:310
#: sphinx/domains/__init__.py:315
#, python-format
msgid "%s %s"
msgstr ""
@ -723,7 +723,7 @@ msgstr ""
msgid "document"
msgstr ""
#: sphinx/domains/std.py:497 sphinx/themes/basic/genindex-single.html:30
#: sphinx/domains/std.py:498 sphinx/themes/basic/genindex-single.html:30
#: sphinx/themes/basic/genindex-single.html:55
#: sphinx/themes/basic/genindex-split.html:11
#: sphinx/themes/basic/genindex-split.html:14
@ -733,15 +733,15 @@ msgstr ""
msgid "Index"
msgstr ""
#: sphinx/domains/std.py:498
#: sphinx/domains/std.py:499
msgid "Module Index"
msgstr ""
#: sphinx/domains/std.py:499 sphinx/themes/basic/defindex.html:25
#: sphinx/domains/std.py:500 sphinx/themes/basic/defindex.html:25
msgid "Search Page"
msgstr ""
#: sphinx/environment/__init__.py:568
#: sphinx/environment/__init__.py:569
#, python-format
msgid ""
"the %s extension does not declare if it is safe for parallel reading, "
@ -763,12 +763,12 @@ msgstr ""
msgid "Symbols"
msgstr ""
#: sphinx/ext/autodoc.py:1451
#: sphinx/ext/autodoc.py:1459
#, python-format
msgid "Bases: %s"
msgstr ""
#: sphinx/ext/autodoc.py:1506
#: sphinx/ext/autodoc.py:1514
#, python-format
msgid "alias of :class:`%s`"
msgstr ""
@ -875,20 +875,20 @@ msgstr ""
msgid "duplicate label of equation %s, other instance in %s"
msgstr ""
#: sphinx/ext/todo.py:66
#: sphinx/ext/todo.py:67
msgid "Todo"
msgstr ""
#: sphinx/ext/todo.py:148
#: sphinx/ext/todo.py:149
msgid "<<original entry>>"
msgstr ""
#: sphinx/ext/todo.py:151
#: sphinx/ext/todo.py:152
#, python-format
msgid "(The <<original entry>> is located in %s, line %d.)"
msgstr ""
#: sphinx/ext/todo.py:160
#: sphinx/ext/todo.py:161
msgid "original entry"
msgstr ""
@ -992,6 +992,14 @@ msgstr ""
msgid "built-in function"
msgstr ""
#: sphinx/templates/latex/longtable.tex_t:18
msgid "continued from previous page"
msgstr ""
#: sphinx/templates/latex/longtable.tex_t:24
msgid "Continued on next page"
msgstr ""
#: sphinx/themes/agogo/layout.html:46 sphinx/themes/basic/globaltoc.html:10
#: sphinx/themes/basic/localtoc.html:11 sphinx/themes/scrolls/layout.html:38
msgid "Table Of Contents"
@ -1154,12 +1162,12 @@ msgid "search"
msgstr ""
#: sphinx/themes/basic/search.html:43 sphinx/themes/basic/searchresults.html:21
#: sphinx/themes/basic/static/searchtools.js_t:336
#: sphinx/themes/basic/static/searchtools.js_t:295
msgid "Search Results"
msgstr ""
#: sphinx/themes/basic/search.html:45 sphinx/themes/basic/searchresults.html:23
#: sphinx/themes/basic/static/searchtools.js_t:338
#: sphinx/themes/basic/static/searchtools.js_t:297
msgid ""
"Your search did not match any documents. Please make sure that all words "
"are spelled correctly and that you've selected enough categories."
@ -1201,45 +1209,45 @@ msgstr ""
msgid "Other changes"
msgstr ""
#: sphinx/themes/basic/static/doctools.js_t:171 sphinx/writers/html.py:405
#: sphinx/writers/html.py:410 sphinx/writers/html5.py:352
#: sphinx/writers/html5.py:357
#: sphinx/themes/basic/static/doctools.js_t:169 sphinx/writers/html.py:403
#: sphinx/writers/html.py:408 sphinx/writers/html5.py:350
#: sphinx/writers/html5.py:355
msgid "Permalink to this headline"
msgstr ""
#: sphinx/themes/basic/static/doctools.js_t:177 sphinx/writers/html.py:126
#: sphinx/writers/html.py:137 sphinx/writers/html5.py:96
#: sphinx/writers/html5.py:107
#: sphinx/themes/basic/static/doctools.js_t:175 sphinx/writers/html.py:124
#: sphinx/writers/html.py:135 sphinx/writers/html5.py:94
#: sphinx/writers/html5.py:105
msgid "Permalink to this definition"
msgstr ""
#: sphinx/themes/basic/static/doctools.js_t:210
#: sphinx/themes/basic/static/doctools.js_t:208
msgid "Hide Search Matches"
msgstr ""
#: sphinx/themes/basic/static/searchtools.js_t:142
#: sphinx/themes/basic/static/searchtools.js_t:129
msgid "Searching"
msgstr ""
#: sphinx/themes/basic/static/searchtools.js_t:147
#: sphinx/themes/basic/static/searchtools.js_t:134
msgid "Preparing search..."
msgstr ""
#: sphinx/themes/basic/static/searchtools.js_t:340
#: sphinx/themes/basic/static/searchtools.js_t:299
#, python-format
msgid "Search finished, found %s page(s) matching the search query."
msgstr ""
#: sphinx/themes/basic/static/searchtools.js_t:398
#: sphinx/themes/basic/static/searchtools.js_t:352
msgid ", in "
msgstr ""
#: sphinx/themes/classic/static/sidebar.js_t:92
#: sphinx/themes/classic/static/sidebar.js_t:83
msgid "Expand sidebar"
msgstr ""
#: sphinx/themes/classic/static/sidebar.js_t:105
#: sphinx/themes/classic/static/sidebar.js_t:135
#: sphinx/themes/classic/static/sidebar.js_t:96
#: sphinx/themes/classic/static/sidebar.js_t:124
msgid "Collapse sidebar"
msgstr ""
@ -1247,17 +1255,17 @@ msgstr ""
msgid "Contents"
msgstr ""
#: sphinx/transforms/post_transforms/__init__.py:105
#: sphinx/transforms/post_transforms/__init__.py:138
#, python-format
msgid "more than one target found for 'any' cross-reference %r: could be %s"
msgstr ""
#: sphinx/transforms/post_transforms/__init__.py:135
#: sphinx/transforms/post_transforms/__init__.py:168
#, python-format
msgid "%s:%s reference target not found: %%(target)s"
msgstr ""
#: sphinx/transforms/post_transforms/__init__.py:138
#: sphinx/transforms/post_transforms/__init__.py:171
#, python-format
msgid "%r reference target not found: %%(target)s"
msgstr ""
@ -1266,19 +1274,19 @@ msgstr ""
msgid "when adding directive classes, no additional arguments may be given"
msgstr ""
#: sphinx/writers/html.py:414 sphinx/writers/html5.py:361
#: sphinx/writers/html.py:412 sphinx/writers/html5.py:359
msgid "Permalink to this table"
msgstr ""
#: sphinx/writers/html.py:466 sphinx/writers/html5.py:413
#: sphinx/writers/html.py:464 sphinx/writers/html5.py:411
msgid "Permalink to this code"
msgstr ""
#: sphinx/writers/html.py:470 sphinx/writers/html5.py:417
#: sphinx/writers/html.py:468 sphinx/writers/html5.py:415
msgid "Permalink to this image"
msgstr ""
#: sphinx/writers/html.py:472 sphinx/writers/html5.py:419
#: sphinx/writers/html.py:470 sphinx/writers/html5.py:417
msgid "Permalink to this toctree"
msgstr ""

View File

@ -721,6 +721,11 @@
% Inspired and adapted from framed.sty's \CustomFBox with extra handling
% of a non separable by pagebreak caption.
% The sole purpose of this macro is to add the framing and the title. The #1
% already has the typeset contents with background color, and took into
% account the \sphinxverbatimsep. The \fboxsep parameter is here zero
% (see \spx@fcolorbox definition) in order for the frame borders to exactly
% fit the colored contents.
\long\def\spx@VerbatimFBox#1{%
\leavevmode
\begingroup

View File

@ -85,6 +85,9 @@ class SphinxTransformer(Transformer):
def apply_transforms(self):
# type: () -> None
if isinstance(self.document, nodes.document):
if hasattr(self.document.settings, 'env') and self.env:
self.document.settings.env = self.env
Transformer.apply_transforms(self)
else:
# wrap the target node by document node during transforming

View File

@ -24,7 +24,7 @@ from sphinx.locale import _
from sphinx.util import logging
logger = logging.getLogger(__name__)
report_re = re.compile('^(.+?:\\d+): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) '
report_re = re.compile('^(.+?:(?:\\d+)?): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) '
'(.+?)\n?$')
if False:

View File

@ -29,20 +29,6 @@ if False:
logger = logging.getLogger(__name__)
class WarningStream(object):
def __init__(self, warnfunc):
# type: (Callable) -> None
self.warnfunc = warnfunc
self._re = re.compile(r'\((DEBUG|INFO|WARNING|ERROR|SEVERE)/[0-4]\)')
def write(self, text):
# type: (str) -> None
text = text.strip()
if text:
self.warnfunc(self._re.sub(r'\1:', text), None, '')
# \x00 means the "<" was backslash-escaped
explicit_title_re = re.compile(r'^(.+?)\s*(?<!\x00)<(.*?)>$', re.DOTALL)
caption_ref_re = explicit_title_re # b/w compat alias

View File

@ -1,6 +1,9 @@
Release x.y.z (in development)
==============================
Dependencies
------------
Incompatible changes
--------------------