From acb9ab6eb96067ace669a5941734e0e58423eb0f Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 11 May 2017 20:19:13 +0900 Subject: [PATCH 1/7] Fix invalid format string --- sphinx/application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/application.py b/sphinx/application.py index 87ed66637..f76474c38 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -469,7 +469,7 @@ class Sphinx(object): def connect(self, event, callback): # type: (unicode, Callable) -> int listener_id = self.events.connect(event, callback) - logger.debug('[app] connecting event %r: %r', event, callback, listener_id) + logger.debug('[app] connecting event %r: %r [id=%s]', event, callback, listener_id) return listener_id def disconnect(self, listener_id): From e83c3804f49a2ee61fcf2078ad2ddc0521cb0a67 Mon Sep 17 00:00:00 2001 From: Bryan Van de Ven Date: Thu, 11 May 2017 08:40:17 -0500 Subject: [PATCH 2/7] Protect isenumclass predicate against non-class arguments fixes: #3731 Not being a class is another way a thing might not be an enum class, but without an explicit check, isenumclass raises an exception in this case. --- sphinx/util/inspect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 861c6f1a2..210ded9f2 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -104,7 +104,7 @@ def isenumclass(x): """Check if the object is subclass of enum.""" if enum is None: return False - return issubclass(x, enum.Enum) + return inspect.isclass(x) and issubclass(x, enum.Enum) def isenumattribute(x): From bac9fcbb561d0346dc1c08eda9a2978816ce46b0 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 11 May 2017 22:45:24 +0900 Subject: [PATCH 3/7] Fix #3738: Nonsensical code in theming.py --- CHANGES | 1 + sphinx/theming.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 408f11641..fbfcfd2ab 100644 --- a/CHANGES +++ b/CHANGES @@ -27,6 +27,7 @@ Bugs fixed longtable class or not (refs #3686) * #3725: Todo looks different from note in LaTeX output * #3479: stub-columns have no effect in LaTeX output +* #3738: Nonsensical code in theming.py Testing -------- diff --git a/sphinx/theming.py b/sphinx/theming.py index c769cfda0..7695323e6 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -233,7 +233,7 @@ class HTMLThemeFactory(object): target = entry_point.load() if callable(target): themedir = target() - if not isinstance(path, string_types): + if not isinstance(themedir, string_types): logger.warning(_('Theme extension %r does not response correctly.') % entry_point.module_name) else: From 90e1aba797e66d631463b5e2dbb44b863605b353 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 12 May 2017 00:46:29 +0900 Subject: [PATCH 4/7] Update CHANGES for PR #3732 --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index bdecba879..ce0c97af8 100644 --- a/CHANGES +++ b/CHANGES @@ -23,6 +23,7 @@ Bugs fixed * #3702: LaTeX writer styles figure legends with a hard-coded ``\small`` * #3708: LaTeX writer allows irc scheme * #3717: Stop enforcing that favicon's must be .ico +* #3731, #3732: Protect isenumclass predicate against non-class arguments Testing -------- From 773659c41ad7dcc457303a503025b65534be5391 Mon Sep 17 00:00:00 2001 From: jfbu Date: Thu, 11 May 2017 22:50:58 +0200 Subject: [PATCH 5/7] Mention latex table templates in docs --- doc/latex.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/latex.rst b/doc/latex.rst index e354fc58b..7a408afd1 100644 --- a/doc/latex.rst +++ b/doc/latex.rst @@ -525,11 +525,18 @@ Let us now list some macros from the package file .. hint:: As an experimental feature, Sphinx can use user-defined template file for - LaTeX source if you have a file named ``_templates/latex.tex_t`` on your - project. Now all template variables are unstable and undocumented. They - will be changed in future version. + LaTeX source if you have a file named ``_templates/latex.tex_t`` in your + project. .. versionadded:: 1.5 + currently all template variables are unstable and undocumented. + + Additional files ``longtable.tex_t``, ``tabulary.tex_t`` and + ``tabular.tex_t`` can be added to ``_templates/`` to configure some aspects + of table rendering (such as the caption position). + + .. versionadded:: 1.6 + currently all template variables are unstable and undocumented. .. raw:: latex From 33837ac4933d7e42a55974e0e55cb7f6d7a1bfe5 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 11 May 2017 19:17:41 +0900 Subject: [PATCH 6/7] Update messages --- sphinx/application.py | 8 ++++---- sphinx/extension.py | 5 ++--- sphinx/theming.py | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sphinx/application.py b/sphinx/application.py index f76474c38..075f828fb 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -205,9 +205,9 @@ class Sphinx(object): self.config.setup(self) else: raise ConfigError( - _("'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.") ) # now that we know all config values, collect them from conf.py @@ -515,7 +515,7 @@ class Sphinx(object): def set_translator(self, name, translator_class): # type: (unicode, Type[nodes.NodeVisitor]) -> None - logger.info(bold(_('A Translator for the %s builder is changed.') % name)) + logger.info(bold(_('Change of translator for the %s builder.') % name)) self.registry.add_translator(name, translator_class) def add_node(self, node, **kwds): diff --git a/sphinx/extension.py b/sphinx/extension.py index 82fd2d976..c3b3b901e 100644 --- a/sphinx/extension.py +++ b/sphinx/extension.py @@ -50,9 +50,8 @@ def verify_required_extensions(app, requirements): for extname, reqversion in iteritems(requirements): extension = app.extensions.get(extname) if extension is None: - logger.warning(_('needs_extensions config value specifies a ' - 'version requirement for extension %s, but it is ' - 'not loaded'), extname) + logger.warning(_('The %s extension is required by needs_extensions settings,' + 'but it is not loaded.'), extname) continue if extension.version == 'unknown version' or reqversion > extension.version: diff --git a/sphinx/theming.py b/sphinx/theming.py index 7695323e6..7a11f4bbf 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -234,7 +234,7 @@ class HTMLThemeFactory(object): if callable(target): themedir = target() if not isinstance(themedir, string_types): - logger.warning(_('Theme extension %r does not response correctly.') % + logger.warning(_('Theme extension %r does not respond correctly.') % entry_point.module_name) else: themedir = target From 4104b93c6eeccd622652d20a187b77acf7accc7e Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 13 May 2017 15:03:11 +0900 Subject: [PATCH 7/7] Fix #3320: Warning about reference target not being found for container types --- CHANGES | 1 + sphinx/domains/python.py | 2 +- tests/roots/test-domain-py/module.rst | 7 +++++++ tests/test_domain_py.py | 6 +++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index ce0c97af8..5c5f55586 100644 --- a/CHANGES +++ b/CHANGES @@ -24,6 +24,7 @@ Bugs fixed * #3708: LaTeX writer allows irc scheme * #3717: Stop enforcing that favicon's must be .ico * #3731, #3732: Protect isenumclass predicate against non-class arguments +* #3320: Warning about reference target not being found for container types Testing -------- diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 11fa719dc..29656d548 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -110,7 +110,7 @@ class PyXrefMixin(object): split_contnode = bool(contnode and contnode.astext() == target) results = [] - for sub_target in sub_targets: + for sub_target in filter(None, sub_targets): if split_contnode: contnode = nodes.Text(sub_target) diff --git a/tests/roots/test-domain-py/module.rst b/tests/roots/test-domain-py/module.rst index f3f138639..deb54629e 100644 --- a/tests/roots/test-domain-py/module.rst +++ b/tests/roots/test-domain-py/module.rst @@ -29,3 +29,10 @@ module .. py:class:: ModTopLevel * Link to :py:class:`ModNoModule` + +.. py:function:: foo(x, y) + + :param x: param x + :type x: int + :param y: param y + :type y: tuple(str, float) diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index 73766e718..6927e9dc2 100644 --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -107,7 +107,11 @@ def test_domain_py_xrefs(app, status, warning): 'ModTopLevel', 'class') assert_refnode(refnodes[6], 'module_b.submodule', 'ModTopLevel', 'ModNoModule', 'class') - assert len(refnodes) == 7 + assert_refnode(refnodes[7], False, False, 'int', 'obj') + assert_refnode(refnodes[8], False, False, 'tuple', 'obj') + assert_refnode(refnodes[9], False, False, 'str', 'obj') + assert_refnode(refnodes[10], False, False, 'float', 'obj') + assert len(refnodes) == 11 @pytest.mark.sphinx('dummy', testroot='domain-py')