Merge branch '1.7'

This commit is contained in:
Takeshi KOMIYA 2018-04-26 01:03:49 +09:00
commit 93837bb01e
8 changed files with 26 additions and 70 deletions

11
CHANGES
View File

@ -88,7 +88,7 @@ Features removed
* ``sphinx.ext.pngmath`` extension
Release 1.7.4 (in development)
Release 1.7.5 (in development)
==============================
Dependencies
@ -109,6 +109,15 @@ Bugs fixed
Testing
--------
Release 1.7.4 (released Apr 25, 2018)
=====================================
Bugs fixed
----------
* #4885, #4887: domains: Crashed with duplicated objects
* #4889: latex: sphinx.writers.latex causes recusrive import
Release 1.7.3 (released Apr 23, 2018)
=====================================

View File

@ -19,7 +19,6 @@ from sphinx.directives import ObjectDescription
from sphinx.domains import Domain, ObjType
from sphinx.locale import _
from sphinx.roles import XRefRole
from sphinx.util import logging
from sphinx.util.docfields import Field, TypedField
from sphinx.util.nodes import make_refnode
@ -30,8 +29,6 @@ if False:
from sphinx.builders import Builder # NOQA
from sphinx.environment import BuildEnvironment # NOQA
logger = logging.getLogger(__name__)
# RE to split at word boundaries
wsplit_re = re.compile(r'(\W+)')
@ -290,13 +287,9 @@ class CDomain(Domain):
def merge_domaindata(self, docnames, otherdata):
# type: (List[unicode], Dict) -> None
# XXX check duplicates
for fullname, (fn, objtype) in otherdata['objects'].items():
if fn in docnames:
if fullname in self.data['objects']:
other, _ = self.data['objects'][fullname]
logger.warning('duplicate C object description of %s, '
'other instance in %s' %
(fullname, self.env.doc2path(other)))
self.data['objects'][fullname] = (fn, objtype)
def resolve_xref(self, env, fromdocname, builder,

View File

@ -18,7 +18,6 @@ from sphinx.domains import Domain, ObjType
from sphinx.domains.python import _pseudo_parse_arglist
from sphinx.locale import _
from sphinx.roles import XRefRole
from sphinx.util import logging
from sphinx.util.docfields import Field, GroupedField, TypedField
from sphinx.util.nodes import make_refnode
@ -30,8 +29,6 @@ if False:
from sphinx.builders import Builder # NOQA
from sphinx.environment import BuildEnvironment # NOQA
logger = logging.getLogger(__name__)
class JSObject(ObjectDescription):
"""
@ -258,12 +255,6 @@ class JSModule(Directive):
noindex = 'noindex' in self.options
ret = []
if not noindex:
modules = env.domaindata['js']['modules']
if mod_name in modules:
self.state_machine.reporter.warning(
'duplicate module description of %s, ' % mod_name +
'other instance in ' + self.env.doc2path(modules[mod_name]),
line=self.lineno)
env.domaindata['js']['modules'][mod_name] = env.docname
# Make a duplicate entry in 'objects' to facilitate searching for
# the module in JavaScriptDomain.find_obj()
@ -344,21 +335,12 @@ class JavaScriptDomain(Domain):
def merge_domaindata(self, docnames, otherdata):
# type: (List[unicode], Dict) -> None
# XXX check duplicates
for fullname, (fn, objtype) in otherdata['objects'].items():
if fn in docnames:
if fullname in self.data['objects']:
otherdoc, _ = self.data['objects'][fullname]
logger.warning('duplicate object description of %s, '
'other instance in %s' %
(fullname, self.env.doc2path(otherdoc)))
self.data['objects'][fullname] = (fn, objtype)
for mod_name, pkg_docname in otherdata['modules'].items():
if pkg_docname in docnames:
if mod_name in self.data['modules']:
otherdoc = self.data['modules'][mod_name]
logger.warning('duplicate module description of %s, '
'other instance in %s' %
(mod_name, self.env.doc2path(otherdoc)))
self.data['modules'][mod_name] = pkg_docname
def find_obj(self, env, mod_name, prefix, name, typ, searchorder=0):

View File

@ -579,17 +579,10 @@ class PyModule(Directive):
env.ref_context['py:module'] = modname
ret = []
if not noindex:
modules = env.domaindata['py']['modules']
if modname in modules:
self.state_machine.reporter.warning(
'duplicate module description of %s, '
'other instance in %s, use :noindex: for one of them' %
(modname, env.doc2path(modules[modname][0])),
line=self.lineno)
modules[modname] = (env.docname,
self.options.get('synopsis', ''),
self.options.get('platform', ''),
'deprecated' in self.options)
env.domaindata['py']['modules'][modname] = (env.docname,
self.options.get('synopsis', ''),
self.options.get('platform', ''),
'deprecated' in self.options)
# make a duplicate entry in 'objects' to facilitate searching for
# the module in PythonDomain.find_obj()
env.domaindata['py']['objects'][modname] = (env.docname, 'module')
@ -784,21 +777,12 @@ class PythonDomain(Domain):
def merge_domaindata(self, docnames, otherdata):
# type: (List[unicode], Dict) -> None
# XXX check duplicates?
for fullname, (fn, objtype) in otherdata['objects'].items():
if fn in docnames:
if fullname in self.data['objects']:
otherdoc, _ = self.data['objects'][fullname]
logger.warning('duplicate object description of %s, '
'other instance in %s, use :noindex: for one of them' %
(fullname, self.env.doc2path(otherdoc)))
self.data['objects'][fullname] = (fn, objtype)
for modname, data in otherdata['modules'].items():
if data[0] in docnames:
if modname in self.data['modules']:
otherdoc, _, _, _ = self.data['modules'][modname]
logger.warning('duplicate module description of %s, '
'other instance in %s, use :noindex: for one of them' %
(modname, self.env.doc2path(otherdoc)))
self.data['modules'][modname] = data
def find_obj(self, env, modname, classname, name, type, searchmode=0):

View File

@ -18,7 +18,6 @@ from sphinx.directives import ObjectDescription
from sphinx.domains import Domain, ObjType
from sphinx.locale import _
from sphinx.roles import XRefRole
from sphinx.util import logging
from sphinx.util.nodes import make_refnode
if False:
@ -30,7 +29,6 @@ if False:
from sphinx.environment import BuildEnvironment # NOQA
logger = logging.getLogger(__name__)
dir_sig_re = re.compile(r'\.\. (.+?)::(.*)$')
@ -141,13 +139,9 @@ class ReSTDomain(Domain):
def merge_domaindata(self, docnames, otherdata):
# type: (List[unicode], Dict) -> None
# XXX check duplicates
for (typ, name), doc in otherdata['objects'].items():
if doc in docnames:
if (typ, name) in self.data['objects']:
otherdoc = self.data['objects'][typ, name]
logger.warning('duplicate description of %s %s, '
'other instance in %s' %
(typ, name, self.env.doc2path(otherdoc)))
self.data['objects'][typ, name] = doc
def resolve_xref(self, env, fromdocname, builder, typ, target, node,

View File

@ -559,6 +559,7 @@ class StandardDomain(Domain):
def merge_domaindata(self, docnames, otherdata):
# type: (List[unicode], Dict) -> None
# XXX duplicates?
for key, data in otherdata['progoptions'].items():
if data[0] in docnames:
self.data['progoptions'][key] = data
@ -567,11 +568,6 @@ class StandardDomain(Domain):
self.data['objects'][key] = data
for key, data in otherdata['citations'].items():
if data[0] in docnames:
if key in self.data['citations']:
otherdoc, _, _ = self.data['catations']
logger.warning('duplicate citation %s, other instance in %s' %
(key, self.env.doc2path(otherdoc)),
type='ref', subtype='citation')
self.data['citations'][key] = data
for key, data in otherdata['citation_refs'].items():
citation_refs = self.data['citation_refs'].setdefault(key, [])
@ -580,10 +576,6 @@ class StandardDomain(Domain):
citation_refs.append(docname)
for key, data in otherdata['labels'].items():
if data[0] in docnames:
if key in self.data['labels']:
otherdoc, _, _ = self.data['labels']
logger.warning('duplicate label %s, other instance in %s' %
(key, self.env.doc2path(otherdoc)))
self.data['labels'][key] = data
for key, data in otherdata['anonlabels'].items():
if data[0] in docnames:

View File

@ -76,10 +76,6 @@ class MathDomain(Domain):
# type: (Iterable[unicode], Dict) -> None
for labelid, (doc, eqno) in otherdata['objects'].items():
if doc in docnames:
if labelid in self.data['objects']:
otherdoc, _ = self.data['objects']
logger.warning('duplicate label of equation %s, other instance in %s' %
(labelid, self.env.doc2path(otherdoc)))
self.data['objects'][labelid] = (doc, eqno)
def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):

View File

@ -23,7 +23,6 @@ from six import itervalues, text_type
from sphinx import addnodes
from sphinx import highlighting
from sphinx.builders.latex.transforms import URI_SCHEMES, ShowUrlsTransform # NOQA # for compatibility
from sphinx.errors import SphinxError
from sphinx.locale import admonitionlabels, _, __
from sphinx.util import split_into, logging
@ -2561,3 +2560,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
def unknown_visit(self, node):
# type: (nodes.Node) -> None
raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
# Import old modules here for compatibility
# They should be imported after `LaTeXTranslator` to avoid recursive import.
#
# refs: https://github.com/sphinx-doc/sphinx/issues/4889
from sphinx.builders.latex.transforms import URI_SCHEMES, ShowUrlsTransform # NOQA