Merge branch '1.7' into 1.8

This commit is contained in:
Takeshi KOMIYA 2018-08-29 01:06:37 +09:00
commit 04d2afdaea
3 changed files with 40 additions and 11 deletions

22
CHANGES
View File

@ -277,7 +277,7 @@ Documentation
* #5083: Fix wrong make.bat option for internationalization.
* #5115: napoleon: add admonitions added by #4613 to the docs.
Release 1.7.8 (in development)
Release 1.7.9 (in development)
==============================
Dependencies
@ -295,12 +295,26 @@ Features added
Bugs fixed
----------
Testing
--------
Release 1.7.8 (released Aug 29, 2018)
=====================================
Incompatible changes
--------------------
* The type of ``env.included`` has been changed to dict of set
Bugs fixed
----------
* #5320: intersphinx: crashed if invalid url given
* #5326: manpage: crashed when invalid docname is specified as ``man_pages``
* #5322: autodoc: ``Any`` typehint causes formatting error
Testing
--------
* #5327: "document isn't included in any toctree" warning on rebuild with
generated files
* #5335: quickstart: escape sequence has been displayed with MacPorts' python
Release 1.7.7 (released Aug 19, 2018)
=====================================

View File

@ -26,10 +26,12 @@ try:
import readline
if readline.__doc__ and 'libedit' in readline.__doc__:
readline.parse_and_bind("bind ^I rl_complete")
USE_LIBEDIT = True
else:
readline.parse_and_bind("tab: complete")
USE_LIBEDIT = False
except ImportError:
pass
USE_LIBEDIT = False
from docutils.utils import column_width
from six import PY2, PY3, text_type, binary_type
@ -197,6 +199,12 @@ def do_prompt(text, default=None, validator=nonempty):
prompt = prompt.encode('utf-8')
except UnicodeEncodeError:
prompt = prompt.encode('latin1')
if USE_LIBEDIT:
# Note: libedit has a problem for combination of ``input()`` and escape
# sequence (see #5335). To avoid the problem, all prompts are not colored
# on libedit.
pass
else:
prompt = colorize(COLOR_QUESTION, prompt, input_mode=True)
x = term_input(prompt).strip()
if default and not x:

View File

@ -19,7 +19,7 @@ from os import path
from docutils.utils import get_source_line
from six import BytesIO, next
from six.moves import cPickle as pickle
from six.moves import cPickle as pickle, reduce
from sphinx import addnodes
from sphinx.deprecation import RemovedInSphinx20Warning, RemovedInSphinx30Warning
@ -139,7 +139,8 @@ class BuildEnvironment(object):
self.dependencies = defaultdict(set) # type: Dict[unicode, Set[unicode]]
# docname -> set of dependent file
# names, relative to documentation root
self.included = set() # type: Set[unicode]
self.included = defaultdict(set) # type: Dict[unicode, Set[unicode]]
# docname -> set of included file
# docnames included from other documents
self.reread_always = set() # type: Set[unicode]
# docnames to re-read unconditionally on
@ -315,8 +316,8 @@ class BuildEnvironment(object):
"""Remove all traces of a source file in the inventory."""
if docname in self.all_docs:
self.all_docs.pop(docname, None)
self.included.pop(docname, None)
self.reread_always.discard(docname)
self.included.discard(docname)
for domain in self.domains.values():
domain.clear_doc(docname)
@ -331,12 +332,17 @@ class BuildEnvironment(object):
docnames = set(docnames) # type: ignore
for docname in docnames:
self.all_docs[docname] = other.all_docs[docname]
self.included[docname] = other.included[docname]
if docname in other.reread_always:
self.reread_always.add(docname)
for docname in other.included:
self.included.add(docname)
for version, changes in other.versionchanges.items():
self.versionchanges.setdefault(version, []).extend(
change for change in changes if change[1] in docnames)
for domainname, domain in self.domains.items():
domain.merge_domaindata(docnames, other.domaindata[domainname])
app.emit('env-merge-info', self, docnames, other)
@ -552,7 +558,7 @@ class BuildEnvironment(object):
*filename* should be absolute or relative to the source directory.
"""
self.included.add(self.path2doc(filename))
self.included[self.docname].add(self.path2doc(filename))
def note_reread(self):
# type: () -> None
@ -721,12 +727,13 @@ class BuildEnvironment(object):
def check_consistency(self):
# type: () -> None
"""Do consistency checks."""
included = reduce(lambda x, y: x | y, self.included.values(), set()) # type: Set[unicode] # NOQA
for docname in sorted(self.all_docs):
if docname not in self.files_to_rebuild:
if docname == self.config.master_doc:
# the master file is not included anywhere ;)
continue
if docname in self.included:
if docname in included:
# the document is included from other documents
continue
if 'orphan' in self.metadata[docname]: