From 294e9041b7d23d35bec15c7b83760ea705cf4395 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 22 Aug 2018 22:36:48 +0900 Subject: [PATCH 1/4] Fix #5327: "document isn't included in any toctree" warning on rebuild with generated files --- CHANGES | 4 ++++ sphinx/environment/__init__.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index f0ca4f51f..1e7e92493 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,8 @@ Dependencies Incompatible changes -------------------- +* The type of ``env.included`` has been changed to dict of set + Deprecated ---------- @@ -19,6 +21,8 @@ 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 +* #5327: "document isn't included in any toctree" warning on rebuild with + generated files Testing -------- diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index db5a229dc..2a48e5b4e 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -22,7 +22,7 @@ from os import path from docutils.frontend import OptionParser from docutils.utils import Reporter, get_source_line from six import BytesIO, itervalues, class_types, next -from six.moves import cPickle as pickle +from six.moves import cPickle as pickle, reduce from sphinx import addnodes, versioning from sphinx.deprecation import RemovedInSphinx20Warning @@ -200,7 +200,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 @@ -309,8 +310,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 version, changes in self.versionchanges.items(): new = [change for change in changes if change[1] != docname] @@ -329,12 +330,10 @@ 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) @@ -724,7 +723,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 @@ -915,12 +914,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]: From 65654fd4324de92ef01f57c342321526de0bb496 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 22 Aug 2018 23:18:55 +0900 Subject: [PATCH 2/4] Fix #5335: quickstart: escape sequence has been displayed with MacPorts' python --- CHANGES | 1 + sphinx/cmd/quickstart.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 1e7e92493..95ab7932e 100644 --- a/CHANGES +++ b/CHANGES @@ -23,6 +23,7 @@ Bugs fixed * #5322: autodoc: ``Any`` typehint causes formatting error * #5327: "document isn't included in any toctree" warning on rebuild with generated files +* #5335: quickstart: escape sequence has been displayed with MacPorts' python Testing -------- diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py index 01b6ca3be..32201d24c 100644 --- a/sphinx/cmd/quickstart.py +++ b/sphinx/cmd/quickstart.py @@ -25,10 +25,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 @@ -195,7 +197,13 @@ def do_prompt(text, default=None, validator=nonempty): prompt = prompt.encode('utf-8') except UnicodeEncodeError: prompt = prompt.encode('latin1') - prompt = colorize(COLOR_QUESTION, prompt, input_mode=True) + 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: x = default From 887c09bf7e7deb35f715021b4abc1af338194abd Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 29 Aug 2018 01:01:17 +0900 Subject: [PATCH 3/4] Bump to 1.7.8 final --- CHANGES | 16 ++-------------- sphinx/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index 95ab7932e..7789005ec 100644 --- a/CHANGES +++ b/CHANGES @@ -1,20 +1,11 @@ -Release 1.7.8 (in development) -============================== - -Dependencies ------------- +Release 1.7.8 (released Aug 29, 2018) +===================================== Incompatible changes -------------------- * The type of ``env.included`` has been changed to dict of set -Deprecated ----------- - -Features added --------------- - Bugs fixed ---------- @@ -25,9 +16,6 @@ Bugs fixed generated files * #5335: quickstart: escape sequence has been displayed with MacPorts' python -Testing --------- - Release 1.7.7 (released Aug 19, 2018) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 7d63364ed..1c5cb4ae6 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -31,13 +31,13 @@ if 'PYTHONWARNINGS' not in os.environ: warnings.filterwarnings('ignore', "'U' mode is deprecated", DeprecationWarning, module='docutils.io') -__version__ = '1.7.8+' +__version__ = '1.7.8' __released__ = '1.7.8' # 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, 7, 8, 'beta', 0) +version_info = (1, 7, 8, 'final', 0) package_dir = path.abspath(path.dirname(__file__)) From 2429cc5bbf9e3c17217c81ead4e473541b7c491d Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 29 Aug 2018 01:03:52 +0900 Subject: [PATCH 4/4] Bump version --- CHANGES | 21 +++++++++++++++++++++ sphinx/__init__.py | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 7789005ec..aca9836b3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,24 @@ +Release 1.7.9 (in development) +============================== + +Dependencies +------------ + +Incompatible changes +-------------------- + +Deprecated +---------- + +Features added +-------------- + +Bugs fixed +---------- + +Testing +-------- + Release 1.7.8 (released Aug 29, 2018) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 1c5cb4ae6..144ece042 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -31,13 +31,13 @@ if 'PYTHONWARNINGS' not in os.environ: warnings.filterwarnings('ignore', "'U' mode is deprecated", DeprecationWarning, module='docutils.io') -__version__ = '1.7.8' -__released__ = '1.7.8' # used when Sphinx builds its own docs +__version__ = '1.7.9+' +__released__ = '1.7.9' # 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, 7, 8, 'final', 0) +version_info = (1, 7, 9, 'beta', 0) package_dir = path.abspath(path.dirname(__file__))