diff --git a/doc/templating.rst b/doc/templating.rst index e174adbec78..f315fce4803 100644 --- a/doc/templating.rst +++ b/doc/templating.rst @@ -273,15 +273,6 @@ in the future. that handles navigation, not the web browser, such as for HTML help or Qt help formats. In this case, the sidebar is not included. -.. data:: favicon - - The path to the HTML favicon in the static path, or URL to the favicon, or - ``''``. - - .. deprecated:: 4.0 - - Recommend to use ``favicon_url`` instead. - .. data:: favicon_url The relative path to the HTML favicon image from the current document, or @@ -308,15 +299,6 @@ in the future. The build date. -.. data:: logo - - The path to the HTML logo image in the static path, or URL to the logo, or - ``''``. - - .. deprecated:: 4.0 - - Recommend to use ``logo_url`` instead. - .. data:: logo_url The relative path to the HTML logo image from the current document, or URL diff --git a/doc/usage/restructuredtext/domains.rst b/doc/usage/restructuredtext/domains.rst index 54e32540037..94354fae162 100644 --- a/doc/usage/restructuredtext/domains.rst +++ b/doc/usage/restructuredtext/domains.rst @@ -427,17 +427,6 @@ The following directives are provided for module and class contents: Describe the location where the object is defined. The default value is the module specified by :rst:dir:`py:currentmodule`. - .. rst:directive:option:: property - :type: no value - - Indicate the method is a property. - - .. versionadded:: 2.1 - - .. deprecated:: 4.0 - - Use :rst:dir:`py:property` instead. - .. rst:directive:option:: staticmethod :type: no value diff --git a/sphinx/application.py b/sphinx/application.py index 2188013229e..caf6ce4dbd4 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -89,7 +89,6 @@ 'sphinx.transforms.post_transforms', 'sphinx.transforms.post_transforms.code', 'sphinx.transforms.post_transforms.images', - 'sphinx.util.compat', 'sphinx.versioning', # collectors should be loaded by specific order 'sphinx.environment.collectors.dependencies', diff --git a/sphinx/builders/html/__init__.py b/sphinx/builders/html/__init__.py index 7737a1d38c5..eae418b992d 100644 --- a/sphinx/builders/html/__init__.py +++ b/sphinx/builders/html/__init__.py @@ -548,8 +548,8 @@ def prepare_writing(self, docnames: Set[str]) -> None: 'rellinks': rellinks, 'builder': self.name, 'parents': [], - 'logo': logo, - 'favicon': favicon, + 'logo_url': logo, + 'favicon_url': favicon, 'html5_doctype': not self.config.html4_writer, } if self.theme: @@ -1227,18 +1227,14 @@ def setup_resource_paths(app: Sphinx, pagename: str, templatename: str, pathto = context.get('pathto') # favicon_url - favicon = context.get('favicon') - if favicon and not isurl(favicon): - context['favicon_url'] = pathto('_static/' + favicon, resource=True) - else: - context['favicon_url'] = favicon + favicon_url = context.get('favicon_url') + if favicon_url and not isurl(favicon_url): + context['favicon_url'] = pathto('_static/' + favicon_url, resource=True) # logo_url - logo = context.get('logo') - if logo and not isurl(logo): - context['logo_url'] = pathto('_static/' + logo, resource=True) - else: - context['logo_url'] = logo + logo_url = context.get('logo_url') + if logo_url and not isurl(logo_url): + context['logo_url'] = pathto('_static/' + logo_url, resource=True) def validate_math_renderer(app: Sphinx) -> None: diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 87635969b4f..09d49681fdb 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -764,15 +764,11 @@ class PyMethod(PyObject): 'async': directives.flag, 'classmethod': directives.flag, 'final': directives.flag, - 'property': directives.flag, 'staticmethod': directives.flag, }) def needs_arglist(self) -> bool: - if 'property' in self.options: - return False - else: - return True + return True def get_signature_prefix(self, sig: str) -> List[nodes.Node]: prefix: List[nodes.Node] = [] @@ -788,9 +784,6 @@ def get_signature_prefix(self, sig: str) -> List[nodes.Node]: if 'classmethod' in self.options: prefix.append(nodes.Text('classmethod')) prefix.append(addnodes.desc_sig_space()) - if 'property' in self.options: - prefix.append(nodes.Text('property')) - prefix.append(addnodes.desc_sig_space()) if 'staticmethod' in self.options: prefix.append(nodes.Text('static')) prefix.append(addnodes.desc_sig_space()) @@ -810,8 +803,6 @@ def get_index_text(self, modname: str, name_cls: Tuple[str, str]) -> str: if 'classmethod' in self.options: return _('%s() (%s class method)') % (methname, clsname) - elif 'property' in self.options: - return _('%s (%s property)') % (methname, clsname) elif 'staticmethod' in self.options: return _('%s() (%s static method)') % (methname, clsname) else: diff --git a/sphinx/util/compat.py b/sphinx/util/compat.py deleted file mode 100644 index 7f332fda709..00000000000 --- a/sphinx/util/compat.py +++ /dev/null @@ -1,33 +0,0 @@ -"""modules for backward compatibility""" - -import sys -from typing import TYPE_CHECKING, Any, Dict - -if TYPE_CHECKING: - from sphinx.application import Sphinx - - -def register_application_for_autosummary(app: "Sphinx") -> None: - """Register application object to autosummary module. - - Since Sphinx-1.7, documenters and attrgetters are registered into - application object. As a result, the arguments of - ``get_documenter()`` has been changed. To keep compatibility, - this handler registers application object to the module. - """ - if 'sphinx.ext.autosummary' in sys.modules: - from sphinx.ext import autosummary - if hasattr(autosummary, '_objects'): - autosummary._objects['_app'] = app # type: ignore - else: - autosummary._app = app # type: ignore - - -def setup(app: "Sphinx") -> Dict[str, Any]: - app.connect('builder-inited', register_application_for_autosummary, priority=100) - - return { - 'version': 'builtin', - 'parallel_read_safe': True, - 'parallel_write_safe': True, - } diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index ce1636eb28e..34c3faa6205 100644 --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -731,10 +731,8 @@ def test_pymethod_options(app): " .. py:method:: meth4\n" " :async:\n" " .. py:method:: meth5\n" - " :property:\n" - " .. py:method:: meth6\n" " :abstractmethod:\n" - " .. py:method:: meth7\n" + " .. py:method:: meth6\n" " :final:\n") domain = app.env.get_domain('py') doctree = restructuredtext.parse(app, text) @@ -752,8 +750,6 @@ def test_pymethod_options(app): addnodes.index, desc, addnodes.index, - desc, - addnodes.index, desc)])])) # method @@ -795,35 +791,26 @@ def test_pymethod_options(app): assert 'Class.meth4' in domain.objects assert domain.objects['Class.meth4'] == ('index', 'Class.meth4', 'method', False) - # :property: + # :abstractmethod: assert_node(doctree[1][1][8], addnodes.index, - entries=[('single', 'meth5 (Class property)', 'Class.meth5', '', None)]) - assert_node(doctree[1][1][9], ([desc_signature, ([desc_annotation, ("property", desc_sig_space)], - [desc_name, "meth5"])], + entries=[('single', 'meth5() (Class method)', 'Class.meth5', '', None)]) + assert_node(doctree[1][1][9], ([desc_signature, ([desc_annotation, ("abstract", desc_sig_space)], + [desc_name, "meth5"], + [desc_parameterlist, ()])], [desc_content, ()])) assert 'Class.meth5' in domain.objects assert domain.objects['Class.meth5'] == ('index', 'Class.meth5', 'method', False) - # :abstractmethod: + # :final: assert_node(doctree[1][1][10], addnodes.index, entries=[('single', 'meth6() (Class method)', 'Class.meth6', '', None)]) - assert_node(doctree[1][1][11], ([desc_signature, ([desc_annotation, ("abstract", desc_sig_space)], + assert_node(doctree[1][1][11], ([desc_signature, ([desc_annotation, ("final", desc_sig_space)], [desc_name, "meth6"], [desc_parameterlist, ()])], [desc_content, ()])) assert 'Class.meth6' in domain.objects assert domain.objects['Class.meth6'] == ('index', 'Class.meth6', 'method', False) - # :final: - assert_node(doctree[1][1][12], addnodes.index, - entries=[('single', 'meth7() (Class method)', 'Class.meth7', '', None)]) - assert_node(doctree[1][1][13], ([desc_signature, ([desc_annotation, ("final", desc_sig_space)], - [desc_name, "meth7"], - [desc_parameterlist, ()])], - [desc_content, ()])) - assert 'Class.meth7' in domain.objects - assert domain.objects['Class.meth7'] == ('index', 'Class.meth7', 'method', False) - def test_pyclassmethod(app): text = (".. py:class:: Class\n"