From 9b2c1c679a9e362b05ae07e5228d564d8889422b Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 5 Jun 2019 23:42:24 +0900 Subject: [PATCH 01/14] Fix #6444: test: replace example.com by existing page --- tests/roots/test-images/index.rst | 2 +- tests/roots/test-intl/external_links.txt | 4 ++-- tests/roots/test-linkcheck/links.txt | 10 +++++----- tests/test_build_html.py | 10 +++++----- tests/test_build_latex.py | 2 +- tests/test_build_linkcheck.py | 8 ++++---- tests/test_intl.py | 4 ++-- tests/test_markup.py | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/roots/test-images/index.rst b/tests/roots/test-images/index.rst index 67b742b278..14a2987a0d 100644 --- a/tests/roots/test-images/index.rst +++ b/tests/roots/test-images/index.rst @@ -26,4 +26,4 @@ test-image .. image:: https://www.python.org/static/img/python-logo.png .. non-exist remote image -.. image:: http://example.com/NOT_EXIST.PNG +.. image:: https://www.google.com/NOT_EXIST.PNG diff --git a/tests/roots/test-intl/external_links.txt b/tests/roots/test-intl/external_links.txt index 96e3973de7..1cecbeeb80 100644 --- a/tests/roots/test-intl/external_links.txt +++ b/tests/roots/test-intl/external_links.txt @@ -23,8 +23,8 @@ link to external1_ and external2_. link to `Sphinx Site `_ and `Python Site `_. -.. _external1: http://example.com/external1 -.. _external2: http://example.com/external2 +.. _external1: https://www.google.com/external1 +.. _external2: https://www.google.com/external2 Multiple references in the same line diff --git a/tests/roots/test-linkcheck/links.txt b/tests/roots/test-linkcheck/links.txt index ac5ed32465..fa8f11e4cf 100644 --- a/tests/roots/test-linkcheck/links.txt +++ b/tests/roots/test-linkcheck/links.txt @@ -6,11 +6,11 @@ This is from CPython documentation. Some additional anchors to exercise ignore code -* `Example Bar invalid `_ -* `Example Bar invalid `_ tests that default ignore anchor of #! does not need to be prefixed with / -* `Example Bar invalid `_ +* `Example Bar invalid `_ +* `Example Bar invalid `_ tests that default ignore anchor of #! does not need to be prefixed with / +* `Example Bar invalid `_ * `Example anchor invalid `_ * `Complete nonsense `_ -.. image:: http://example.com/image.png -.. figure:: http://example.com/image2.png +.. image:: https://www.google.com/image.png +.. figure:: https://www.google.com/image2.png diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 677ca9de03..c66acbc756 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -1239,25 +1239,25 @@ def test_html_entity(app): def test_html_inventory(app): app.builder.build_all() with open(app.outdir / 'objects.inv', 'rb') as f: - invdata = InventoryFile.load(f, 'http://example.com', os.path.join) + invdata = InventoryFile.load(f, 'https://www.google.com', os.path.join) assert set(invdata.keys()) == {'std:label', 'std:doc'} assert set(invdata['std:label'].keys()) == {'modindex', 'genindex', 'search'} assert invdata['std:label']['modindex'] == ('Python', '', - 'http://example.com/py-modindex.html', + 'https://www.google.com/py-modindex.html', 'Module Index') assert invdata['std:label']['genindex'] == ('Python', '', - 'http://example.com/genindex.html', + 'https://www.google.com/genindex.html', 'Index') assert invdata['std:label']['search'] == ('Python', '', - 'http://example.com/search.html', + 'https://www.google.com/search.html', 'Search Page') assert set(invdata['std:doc'].keys()) == {'index'} assert invdata['std:doc']['index'] == ('Python', '', - 'http://example.com/index.html', + 'https://www.google.com/index.html', 'The basic Sphinx documentation for testing') diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index 13bb22e96e..56dfa7ca47 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -1242,7 +1242,7 @@ def test_latex_images(app, status, warning): # not found images assert '\\sphinxincludegraphics{{NOT_EXIST}.PNG}' not in result assert ('WARNING: Could not fetch remote image: ' - 'http://example.com/NOT_EXIST.PNG [404]' in warning.getvalue()) + 'https://www.google.com/NOT_EXIST.PNG [404]' in warning.getvalue()) # an image having target assert ('\\sphinxhref{https://www.sphinx-doc.org/}' diff --git a/tests/test_build_linkcheck.py b/tests/test_build_linkcheck.py index 6d25058eb8..4bf47a9626 100644 --- a/tests/test_build_linkcheck.py +++ b/tests/test_build_linkcheck.py @@ -25,8 +25,8 @@ def test_defaults(app, status, warning): # looking for non-existent URL should fail assert " Max retries exceeded with url: /doesnotexist" in content # images should fail - assert "Not Found for url: http://example.com/image.png" in content - assert "Not Found for url: http://example.com/image2.png" in content + assert "Not Found for url: https://www.google.com/image.png" in content + assert "Not Found for url: https://www.google.com/image2.png" in content assert len(content.splitlines()) == 5 @@ -36,8 +36,8 @@ def test_defaults(app, status, warning): 'linkcheck_ignore': [ 'https://localhost:7777/doesnotexist', 'http://www.sphinx-doc.org/en/1.7/intro.html#', - 'http://example.com/image.png', - 'http://example.com/image2.png'] + 'https://www.google.com/image.png', + 'https://www.google.com/image2.png'] }) def test_anchors_ignored(app, status, warning): app.builder.build_all() diff --git a/tests/test_intl.py b/tests/test_intl.py index a052266b8a..9790f50a35 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -885,8 +885,8 @@ def test_xml_keep_external_links(app): assert_elem( para1[0], ['LINK TO', 'external2', 'AND', 'external1', '.'], - ['http://example.com/external2', - 'http://example.com/external1']) + ['https://www.google.com/external2', + 'https://www.google.com/external1']) assert_elem( para1[1], ['LINK TO', 'THE PYTHON SITE', 'AND', 'THE SPHINX SITE', '.'], diff --git a/tests/test_markup.py b/tests/test_markup.py index 006d19caa7..b8c9b66d9a 100644 --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -279,9 +279,9 @@ def get_verifier(verify, verify_re): ( # in URIs 'verify_re', - '`test `_', + '`test `_', None, - r'\\sphinxhref{http://example.com/~me/}{test}.*', + r'\\sphinxhref{https://www.google.com/~me/}{test}.*', ), ( # description list: simple From 3973e897d18aa0b646e7f2bf9d90aba87b9d3a98 Mon Sep 17 00:00:00 2001 From: Viktor Haag Date: Thu, 13 Jun 2019 14:01:57 -0400 Subject: [PATCH 02/14] Explicitly treat ObjectDescription._doc_field_type_map as an instance variable - Aims to address [issue #6478](https://github.com/sphinx-doc/sphinx/issues/6478) - Left ObjectDescription._doc_field_type_map declaration alone and in place in case there are other factors at play that require it declared on the class. - In ObjectDescription constructor, explicitly set _doc_field_type_map's value as an instance variable. - This presumably needs to be built with every instantiation of an ObjectDescription or inheriting class, so we're not attempting to "define it once on a class and then use it"... that approach seems much harder to reason about and get correctly done (as was maybe demonstrated by the refactoring that lead to this problem in the linked-to issue). - Runs through the test suite clean locally except for an unrelated single test failure on an image_converter test, which also failed on the base branch before my changes here. --- sphinx/directives/__init__.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index 40f838c483..68a27090f8 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -70,18 +70,23 @@ class ObjectDescription(SphinxDirective): # Warning: this might be removed in future version. Don't touch this from extensions. _doc_field_type_map = {} # type: Dict[str, Tuple[Field, bool]] + def _process_type_map(self, typelist): + typemap = {} + for field in typelist: + for name in field.names: + typemap[name] = (field, False) + if field.is_typed: + typed_field = cast(TypedField, field) + for name in typed_field.typenames: + typemap[name] = (field, True) + return typemap + + def __init__(self, *args, **kwargs): + SphinxDirective.__init__(self, *args, **kwargs) + self._doc_field_type_map = self._process_type_map(self.doc_field_types) + def get_field_type_map(self): # type: () -> Dict[str, Tuple[Field, bool]] - if self._doc_field_type_map == {}: - for field in self.doc_field_types: - for name in field.names: - self._doc_field_type_map[name] = (field, False) - - if field.is_typed: - typed_field = cast(TypedField, field) - for name in typed_field.typenames: - self._doc_field_type_map[name] = (field, True) - return self._doc_field_type_map def get_signatures(self): From 085ae2e08187acc5dfdff7e79364e5962afc121c Mon Sep 17 00:00:00 2001 From: Viktor Haag Date: Thu, 13 Jun 2019 14:29:21 -0400 Subject: [PATCH 03/14] type declaration for new internal method --- sphinx/directives/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index 68a27090f8..72ab221d28 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -71,6 +71,7 @@ class ObjectDescription(SphinxDirective): _doc_field_type_map = {} # type: Dict[str, Tuple[Field, bool]] def _process_type_map(self, typelist): + # type: () -> Dict[str, Tuple[Field, bool]] typemap = {} for field in typelist: for name in field.names: From d19dd1c8dec8cc80229e8314cdbc37650b366eaf Mon Sep 17 00:00:00 2001 From: Viktor Haag Date: Fri, 14 Jun 2019 08:02:24 -0400 Subject: [PATCH 04/14] mypy type annotations for methods added - type annotation for _process_type_map was incorrect; needed to document the positional argument for the method - __init__ method for ObjectDescription missing type annotation, so added --- sphinx/directives/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index 72ab221d28..3eb3866f4d 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -71,7 +71,7 @@ class ObjectDescription(SphinxDirective): _doc_field_type_map = {} # type: Dict[str, Tuple[Field, bool]] def _process_type_map(self, typelist): - # type: () -> Dict[str, Tuple[Field, bool]] + # type: (List[Field]) -> Dict[str, Tuple[Field, bool]] typemap = {} for field in typelist: for name in field.names: @@ -83,6 +83,7 @@ class ObjectDescription(SphinxDirective): return typemap def __init__(self, *args, **kwargs): + # type: (*Any, **Any) -> None SphinxDirective.__init__(self, *args, **kwargs) self._doc_field_type_map = self._process_type_map(self.doc_field_types) From 2119a65b860ea6619efe0881118cc3c693558ac5 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Tue, 18 Jun 2019 01:43:14 +0900 Subject: [PATCH 05/14] Fix #6497: custom lexers fails highlighting when syntax error --- CHANGES | 2 ++ sphinx/highlighting.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 937e6133ff..d10eac1644 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,8 @@ Features added Bugs fixed ---------- +* #6497: custom lexers fails highlighting when syntax error + Testing -------- diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index 2d825e9f1d..b4e63209fa 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -139,7 +139,8 @@ class PygmentsBridge: lexer = lexers['none'] if lang in lexers: - lexer = lexers[lang] + # just return custom lexers here (without installing raiseonerror filter) + return lexers[lang] elif lang in lexer_classes: lexer = lexer_classes[lang](**opts) else: From 6a054355d92628fbfa4670f097b5ce20db6fdc2e Mon Sep 17 00:00:00 2001 From: Viktor Haag Date: Tue, 18 Jun 2019 09:22:25 -0400 Subject: [PATCH 06/14] Simplify to ensure we're lazily setting the instance field-type-map variable - We can more simply have ObjectDescription.get_field_type_map() make sure that it's going to lazily set the value of an instance variable, not the class variable, when it populates the field type map. --- sphinx/directives/__init__.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index 3eb3866f4d..8a17fc0a52 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -70,25 +70,17 @@ class ObjectDescription(SphinxDirective): # Warning: this might be removed in future version. Don't touch this from extensions. _doc_field_type_map = {} # type: Dict[str, Tuple[Field, bool]] - def _process_type_map(self, typelist): - # type: (List[Field]) -> Dict[str, Tuple[Field, bool]] - typemap = {} - for field in typelist: - for name in field.names: - typemap[name] = (field, False) - if field.is_typed: - typed_field = cast(TypedField, field) - for name in typed_field.typenames: - typemap[name] = (field, True) - return typemap - - def __init__(self, *args, **kwargs): - # type: (*Any, **Any) -> None - SphinxDirective.__init__(self, *args, **kwargs) - self._doc_field_type_map = self._process_type_map(self.doc_field_types) - def get_field_type_map(self): # type: () -> Dict[str, Tuple[Field, bool]] + if self._doc_field_type_map == {}: + self._doc_field_type_map = {} + for field in self.doc_field_types: + for name in field.names: + self._doc_field_type_map[name] = (field, False) + if field.is_typed: + typed_field = cast(TypedField, field) + for name in typed_field.typenames: + self._doc_field_type_map[name] = (field, True) return self._doc_field_type_map def get_signatures(self): From e9ee39d655be2c1aff29aa3716f9f3dfbcd82006 Mon Sep 17 00:00:00 2001 From: Viktor Haag Date: Tue, 18 Jun 2019 09:37:52 -0400 Subject: [PATCH 07/14] repair white space --- sphinx/directives/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index 8a17fc0a52..f7fd642709 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -77,10 +77,12 @@ class ObjectDescription(SphinxDirective): for field in self.doc_field_types: for name in field.names: self._doc_field_type_map[name] = (field, False) + if field.is_typed: typed_field = cast(TypedField, field) for name in typed_field.typenames: self._doc_field_type_map[name] = (field, True) + return self._doc_field_type_map def get_signatures(self): From a6a38c803f81782b51bdd7eaf8a22488044c5c23 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 19 Jun 2019 01:58:16 +0900 Subject: [PATCH 08/14] Suppress deprecation warning for autosummary --- sphinx/ext/autosummary/generate.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index b6ced22565..5419e41dfb 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -208,23 +208,25 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst', if info: warnings.warn('info argument for generate_autosummary_docs() is deprecated.', RemovedInSphinx40Warning) + _info = info else: - info = logger.info + _info = logger.info if warn: warnings.warn('warn argument for generate_autosummary_docs() is deprecated.', RemovedInSphinx40Warning) + _warn = warn else: - warn = logger.warning + _warn = logger.warning showed_sources = list(sorted(sources)) if len(showed_sources) > 20: showed_sources = showed_sources[:10] + ['...'] + showed_sources[-10:] - info(__('[autosummary] generating autosummary for: %s') % - ', '.join(showed_sources)) + _info(__('[autosummary] generating autosummary for: %s') % + ', '.join(showed_sources)) if output_dir: - info(__('[autosummary] writing to %s') % output_dir) + _info(__('[autosummary] writing to %s') % output_dir) if base_path is not None: sources = [os.path.join(base_path, filename) for filename in sources] @@ -250,7 +252,7 @@ def generate_autosummary_docs(sources, output_dir=None, suffix='.rst', try: name, obj, parent, mod_name = import_by_name(name) except ImportError as e: - warn('[autosummary] failed to import %r: %s' % (name, e)) + _warn('[autosummary] failed to import %r: %s' % (name, e)) continue fn = os.path.join(path, name + suffix) From 1aa1373ce34f15a7a730c5a0df40264574649af2 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 19 Jun 2019 01:05:47 +0900 Subject: [PATCH 09/14] Fix #6498: autosummary: crashed with wrong autosummary_generate setting --- CHANGES | 1 + sphinx/ext/autosummary/__init__.py | 20 +++++++++++++------- tests/test_ext_autosummary.py | 6 ++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index e5c83ddb06..088fae4345 100644 --- a/CHANGES +++ b/CHANGES @@ -41,6 +41,7 @@ Bugs fixed * #5502: linkcheck: Consider HTTP 503 response as not an error * #6439: Make generated download links reproducible * #6486: UnboundLocalError is raised if broken extension installed +* #6498: autosummary: crashed with wrong autosummary_generate setting Testing -------- diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index 6eb0fea9bc..19c4006098 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -58,6 +58,7 @@ import posixpath import re import sys import warnings +from os import path from types import ModuleType from typing import List, cast @@ -731,26 +732,31 @@ def process_generate_options(app): # type: (Sphinx) -> None genfiles = app.config.autosummary_generate - if genfiles and not hasattr(genfiles, '__len__'): + if genfiles is True: env = app.builder.env genfiles = [env.doc2path(x, base=None) for x in env.found_docs if os.path.isfile(env.doc2path(x))] + else: + ext = list(app.config.source_suffix) + genfiles = [genfile + (not genfile.endswith(tuple(ext)) and ext[0] or '') + for genfile in genfiles] + + for entry in genfiles[:]: + if not path.isfile(path.join(app.srcdir, entry)): + logger.warning(__('autosummary_generate: file not found: %s'), entry) + genfiles.remove(entry) if not genfiles: return - from sphinx.ext.autosummary.generate import generate_autosummary_docs - - ext = list(app.config.source_suffix) - genfiles = [genfile + (not genfile.endswith(tuple(ext)) and ext[0] or '') - for genfile in genfiles] - suffix = get_rst_suffix(app) if suffix is None: logger.warning(__('autosummary generats .rst files internally. ' 'But your source_suffix does not contain .rst. Skipped.')) return + from sphinx.ext.autosummary.generate import generate_autosummary_docs + imported_members = app.config.autosummary_imported_members with mock(app.config.autosummary_mock_imports): generate_autosummary_docs(genfiles, builder=app.builder, diff --git a/tests/test_ext_autosummary.py b/tests/test_ext_autosummary.py index ae97d3b579..ae2b2d5853 100644 --- a/tests/test_ext_autosummary.py +++ b/tests/test_ext_autosummary.py @@ -302,3 +302,9 @@ def test_generate_autosummary_docs_property(app): ".. currentmodule:: target.methods\n" "\n" ".. autoproperty:: Base.prop") + + +@pytest.mark.sphinx('dummy', testroot='ext-autosummary', + confoverrides={'autosummary_generate': ['unknown']}) +def test_invalid_autosummary_generate(app, status, warning): + assert 'WARNING: autosummary_generate: file not found: unknown.rst' in warning.getvalue() From 2709cd3cd18394b0771de0539caaffabe8f7d502 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 19 Jun 2019 20:30:03 +0900 Subject: [PATCH 10/14] Update CHANGES for PR #6482 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index d10eac1644..8bd7f20638 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,7 @@ Bugs fixed ---------- * #6497: custom lexers fails highlighting when syntax error +* #6478, #6488: info field lists are incorrectly recognized Testing -------- From 131c93caf59a4737f31b6e187e17a3366c28109d Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Wed, 12 Jun 2019 17:56:46 -0700 Subject: [PATCH 11/14] Remove "universal" configuration from setup.cfg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sphinx is Python-3-only and therefore is not a universal wheel. It should still distribute a 'py3' wheel, just not a universal one. From https://wheel.readthedocs.io/en/stable/user_guide.html > If your project contains no C extensions and is expected to work on > both Python 2 and 3, you will want to tell wheel to produce universal > wheels by adding this to your setup.cfg file: … As Sphinx doesn't work on Python 2, it should not be universal. Refs #6470 --- setup.cfg | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index c91a31879c..1f5bbd1cd4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,9 +5,6 @@ license_file = LICENSE tag_build = .dev tag_date = true -[bdist_wheel] -universal = 1 - [aliases] release = egg_info -Db '' upload = upload --sign --identity=36580288 From 39563d1b294ef5cce7102ad82177e99f646ba042 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 19 Jun 2019 20:30:38 +0900 Subject: [PATCH 12/14] Bump to 2.1.2 final --- CHANGES | 19 ++----------------- sphinx/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/CHANGES b/CHANGES index 8bd7f20638..a2233ad9eb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,17 +1,5 @@ -Release 2.1.2 (in development) -============================== - -Dependencies ------------- - -Incompatible changes --------------------- - -Deprecated ----------- - -Features added --------------- +Release 2.1.2 (released Jun 19, 2019) +===================================== Bugs fixed ---------- @@ -19,9 +7,6 @@ Bugs fixed * #6497: custom lexers fails highlighting when syntax error * #6478, #6488: info field lists are incorrectly recognized -Testing --------- - Release 2.1.1 (released Jun 10, 2019) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 094884e5b5..3f05fd0db4 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -32,7 +32,7 @@ if 'PYTHONWARNINGS' not in os.environ: warnings.filterwarnings('ignore', "'U' mode is deprecated", DeprecationWarning, module='docutils.io') -__version__ = '2.1.2+' +__version__ = '2.1.2' __released__ = '2.1.2' # used when Sphinx builds its own docs #: Version info for better programmatic use. @@ -43,7 +43,7 @@ __released__ = '2.1.2' # used when Sphinx builds its own docs #: #: .. versionadded:: 1.2 #: Before version 1.2, check the string ``sphinx.__version__``. -version_info = (2, 1, 2, 'beta', 0) +version_info = (2, 1, 2, 'final', 0) package_dir = path.abspath(path.dirname(__file__)) From 6595f65b0e9c03fb4dd306be5d7c9e742893475f Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 19 Jun 2019 20:34:10 +0900 Subject: [PATCH 13/14] Bump version --- CHANGES | 21 +++++++++++++++++++++ sphinx/__init__.py | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index a2233ad9eb..36046b9a13 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,24 @@ +Release 2.1.3 (in development) +============================== + +Dependencies +------------ + +Incompatible changes +-------------------- + +Deprecated +---------- + +Features added +-------------- + +Bugs fixed +---------- + +Testing +-------- + Release 2.1.2 (released Jun 19, 2019) ===================================== diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 3f05fd0db4..4ceb0955cf 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -32,8 +32,8 @@ if 'PYTHONWARNINGS' not in os.environ: warnings.filterwarnings('ignore', "'U' mode is deprecated", DeprecationWarning, module='docutils.io') -__version__ = '2.1.2' -__released__ = '2.1.2' # used when Sphinx builds its own docs +__version__ = '2.1.3+' +__released__ = '2.1.3' # used when Sphinx builds its own docs #: Version info for better programmatic use. #: @@ -43,7 +43,7 @@ __released__ = '2.1.2' # used when Sphinx builds its own docs #: #: .. versionadded:: 1.2 #: Before version 1.2, check the string ``sphinx.__version__``. -version_info = (2, 1, 2, 'final', 0) +version_info = (2, 1, 3, 'beta', 0) package_dir = path.abspath(path.dirname(__file__)) From 224d247ca0cc95b704f6007ba9556ae6925dae4b Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 21 Jun 2019 11:07:27 +0900 Subject: [PATCH 14/14] Fix mypy violations (for mypy-0.710) --- setup.py | 2 +- sphinx/domains/std.py | 9 +++++---- sphinx/util/inspect.py | 2 +- sphinx/util/stemmer/__init__.py | 2 +- sphinx/writers/latex.py | 2 +- sphinx/writers/texinfo.py | 2 +- sphinx/writers/text.py | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 91b3e12cc6..2b6e257130 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ extras_require = { 'html5lib', 'flake8>=3.5.0', 'flake8-import-order', - 'mypy>=0.590', + 'mypy>=0.710', 'docutils-stubs', ], } diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index 01cc797c3a..45516ebd9f 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -910,12 +910,13 @@ class StandardDomain(Domain): # type: (nodes.Node) -> str """Get the title of enumerable nodes to refer them using its title""" if self.is_enumerable_node(node): - _, title_getter = self.enumerable_nodes.get(node.__class__, (None, None)) + elem = cast(nodes.Element, node) + _, title_getter = self.enumerable_nodes.get(elem.__class__, (None, None)) if title_getter: - return title_getter(node) + return title_getter(elem) else: - for subnode in node: - if subnode.tagname in ('caption', 'title'): + for subnode in elem: + if isinstance(subnode, (nodes.caption, nodes.title)): return clean_astext(subnode) return None diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 42530eb408..c49708242e 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -129,7 +129,7 @@ def isenumattribute(x): def ispartial(obj): # type: (Any) -> bool """Check if the object is partial.""" - return isinstance(obj, (partial, partialmethod)) + return isinstance(obj, (partial, partialmethod)) # type: ignore def isclassmethod(obj): diff --git a/sphinx/util/stemmer/__init__.py b/sphinx/util/stemmer/__init__.py index 047aac708a..b9fb5c252b 100644 --- a/sphinx/util/stemmer/__init__.py +++ b/sphinx/util/stemmer/__init__.py @@ -33,7 +33,7 @@ class PyStemmer(BaseStemmer): return self.stemmer.stemWord(word) -class StandardStemmer(PorterStemmer, BaseStemmer): # type: ignore +class StandardStemmer(PorterStemmer, BaseStemmer): """All those porter stemmer implementations look hideous; make at least the stem method nicer. """ diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 5c7f525074..24ec059e54 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -2598,7 +2598,7 @@ class LaTeXTranslator(SphinxTranslator): RemovedInSphinx30Warning) def visit_admonition(self, node): - # type: (nodes.Element) -> None + # type: (LaTeXTranslator, nodes.Element) -> None self.body.append('\n\\begin{sphinxadmonition}{%s}{%s:}' % (name, admonitionlabels[name])) return visit_admonition diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index 4262ccd666..b952812f0a 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -1752,6 +1752,6 @@ class TexinfoTranslator(SphinxTranslator): RemovedInSphinx30Warning) def visit(self, node): - # type: (nodes.Element) -> None + # type: (TexinfoTranslator, nodes.Element) -> None self.visit_admonition(node, admonitionlabels[name]) return visit diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index 1447510c32..dc8a7963ae 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -1375,6 +1375,6 @@ class TextTranslator(SphinxTranslator): RemovedInSphinx30Warning) def depart_admonition(self, node): - # type: (nodes.Element) -> None + # type: (TextTranslator, nodes.Element) -> None self.end_state(first=admonitionlabels[name] + ': ') return depart_admonition