| |
@@ -1,25 +1,25 @@
|
| |
- From 9699465414515f0eba76d05069e755b5bcf34eef Mon Sep 17 00:00:00 2001
|
| |
+ From b74128966fe4edf77a0c3a7936f6a6216833c9ed Mon Sep 17 00:00:00 2001
|
| |
From: Karolina Surma <ksurma@redhat.com>
|
| |
- Date: Mon, 15 Jan 2024 16:19:32 +0100
|
| |
+ Date: Thu, 25 Apr 2024 15:58:03 +0200
|
| |
Subject: [PATCH] Make the first party extensions optional, add [extensions]
|
| |
extra
|
| |
|
| |
|
| |
Co-authored-by: Miro HronĨok <miro@hroncok.cz>
|
| |
---
|
| |
- pyproject.toml | 33 +++++++++++++++++++++++++++------
|
| |
- sphinx/application.py | 6 +++---
|
| |
- sphinx/registry.py | 9 ++++++---
|
| |
- sphinx/testing/fixtures.py | 6 ++++++
|
| |
- tests/test_api_translator.py | 2 ++
|
| |
- tests/test_build_html.py | 3 +++
|
| |
- 6 files changed, 47 insertions(+), 12 deletions(-)
|
| |
+ pyproject.toml | 33 ++++++++++++++++----
|
| |
+ sphinx/application.py | 6 ++--
|
| |
+ sphinx/registry.py | 9 ++++--
|
| |
+ sphinx/testing/fixtures.py | 7 +++++
|
| |
+ tests/test_builders/test_build_html_maths.py | 3 ++
|
| |
+ tests/test_writers/test_api_translator.py | 2 ++
|
| |
+ 6 files changed, 48 insertions(+), 12 deletions(-)
|
| |
|
| |
diff --git a/pyproject.toml b/pyproject.toml
|
| |
- index 8f93701..41c28c5 100644
|
| |
+ index 8aa49aa..10fa20e 100644
|
| |
--- a/pyproject.toml
|
| |
+++ b/pyproject.toml
|
| |
- @@ -55,12 +55,6 @@ classifiers = [
|
| |
+ @@ -56,12 +56,6 @@ classifiers = [
|
| |
"Topic :: Utilities",
|
| |
]
|
| |
dependencies = [
|
| |
@@ -31,8 +31,8 @@
|
| |
- "sphinxcontrib-qthelp",
|
| |
"Jinja2>=3.0",
|
| |
"Pygments>=2.14",
|
| |
- "docutils>=0.18.1,<0.21",
|
| |
- @@ -76,8 +70,35 @@ dependencies = [
|
| |
+ "docutils>=0.18.1,<0.22",
|
| |
+ @@ -78,8 +72,35 @@ dependencies = [
|
| |
dynamic = ["version"]
|
| |
|
| |
[project.optional-dependencies]
|
| |
@@ -69,10 +69,10 @@
|
| |
lint = [
|
| |
"flake8>=3.5.0",
|
| |
diff --git a/sphinx/application.py b/sphinx/application.py
|
| |
- index d5fbaa9..b030dab 100644
|
| |
+ index 7d16d9a..2a71074 100644
|
| |
--- a/sphinx/application.py
|
| |
+++ b/sphinx/application.py
|
| |
- @@ -226,7 +226,7 @@ class Sphinx:
|
| |
+ @@ -222,7 +222,7 @@ class Sphinx:
|
| |
# load all built-in extension modules, first-party extension modules,
|
| |
# and first-party themes
|
| |
for extension in builtin_extensions:
|
| |
@@ -81,7 +81,7 @@
|
| |
|
| |
# load all user-given extension modules
|
| |
for extension in self.config.extensions:
|
| |
- @@ -395,7 +395,7 @@ class Sphinx:
|
| |
+ @@ -391,7 +391,7 @@ class Sphinx:
|
| |
|
| |
# ---- general extensibility interface -------------------------------------
|
| |
|
| |
@@ -90,7 +90,7 @@
|
| |
"""Import and setup a Sphinx extension module.
|
| |
|
| |
Load the extension given by the module *name*. Use this if your
|
| |
- @@ -403,7 +403,7 @@ class Sphinx:
|
| |
+ @@ -399,7 +399,7 @@ class Sphinx:
|
| |
called twice.
|
| |
"""
|
| |
logger.debug('[app] setting up extension: %r', extname)
|
| |
@@ -100,10 +100,10 @@
|
| |
@staticmethod
|
| |
def require_sphinx(version: tuple[int, int] | str) -> None:
|
| |
diff --git a/sphinx/registry.py b/sphinx/registry.py
|
| |
- index 501661d..96d4554 100644
|
| |
+ index 7887858..ca95960 100644
|
| |
--- a/sphinx/registry.py
|
| |
+++ b/sphinx/registry.py
|
| |
- @@ -430,7 +430,7 @@ class SphinxComponentRegistry:
|
| |
+ @@ -436,7 +436,7 @@ class SphinxComponentRegistry:
|
| |
def add_html_theme(self, name: str, theme_path: str) -> None:
|
| |
self.html_themes[name] = theme_path
|
| |
|
| |
@@ -112,7 +112,7 @@
|
| |
"""Load a Sphinx extension."""
|
| |
if extname in app.extensions: # already loaded
|
| |
return
|
| |
- @@ -446,9 +446,12 @@ class SphinxComponentRegistry:
|
| |
+ @@ -452,9 +452,12 @@ class SphinxComponentRegistry:
|
| |
try:
|
| |
mod = import_module(extname)
|
| |
except ImportError as err:
|
| |
@@ -125,24 +125,25 @@
|
| |
- err) from err
|
| |
+ raise ExtensionError(msg % extname, err) from err
|
| |
|
| |
- setup = getattr(mod, 'setup', None)
|
| |
+ setup: _ExtensionSetupFunc | None = getattr(mod, 'setup', None)
|
| |
if setup is None:
|
| |
diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py
|
| |
- index 0cc4882..f57f709 100644
|
| |
+ index 6e1a122..f3fe743 100644
|
| |
--- a/sphinx/testing/fixtures.py
|
| |
+++ b/sphinx/testing/fixtures.py
|
| |
- @@ -22,6 +22,7 @@ DEFAULT_ENABLED_MARKERS = [
|
| |
- 'sphinx(builder, testroot=None, freshenv=False, confoverrides=None, tags=None,'
|
| |
- ' docutilsconf=None, parallel=0): arguments to initialize the sphinx test application.'
|
| |
+ @@ -31,6 +31,7 @@ DEFAULT_ENABLED_MARKERS = [
|
| |
+ 'keep_going=False, builddir=None, docutils_conf=None'
|
| |
+ '): arguments to initialize the sphinx test application.'
|
| |
),
|
| |
+ 'sphinxcontrib(...): required sphinxcontrib.* extensions',
|
| |
'test_params(shared_result=...): test parameters.',
|
| |
]
|
| |
|
| |
- @@ -67,6 +68,11 @@ def app_params(request: Any, test_params: dict, shared_result: SharedResult,
|
| |
+ @@ -80,6 +81,12 @@ def app_params(
|
| |
+ Parameters that are specified by 'pytest.mark.sphinx' for
|
| |
sphinx.application.Sphinx initialization
|
| |
"""
|
| |
-
|
| |
+ +
|
| |
+ # ##### process pytest.mark.sphinxcontrib
|
| |
+ for info in reversed(list(request.node.iter_markers("sphinxcontrib"))):
|
| |
+ for arg in info.args:
|
| |
@@ -150,32 +151,12 @@
|
| |
+
|
| |
# ##### process pytest.mark.sphinx
|
| |
|
| |
- pargs = {}
|
| |
- diff --git a/tests/test_api_translator.py b/tests/test_api_translator.py
|
| |
- index 9f2bd44..81575b7 100644
|
| |
- --- a/tests/test_api_translator.py
|
| |
- +++ b/tests/test_api_translator.py
|
| |
- @@ -36,6 +36,7 @@ def test_singlehtml_set_translator_for_singlehtml(app, status, warning):
|
| |
- assert translator_class.__name__ == 'ConfSingleHTMLTranslator'
|
| |
-
|
| |
-
|
| |
- +@pytest.mark.sphinxcontrib('serializinghtml')
|
| |
- @pytest.mark.sphinx('pickle', testroot='api-set-translator')
|
| |
- def test_pickle_set_translator_for_pickle(app, status, warning):
|
| |
- translator_class = app.builder.get_translator_class()
|
| |
- @@ -43,6 +44,7 @@ def test_pickle_set_translator_for_pickle(app, status, warning):
|
| |
- assert translator_class.__name__ == 'ConfPickleTranslator'
|
| |
-
|
| |
-
|
| |
- +@pytest.mark.sphinxcontrib('serializinghtml')
|
| |
- @pytest.mark.sphinx('json', testroot='api-set-translator')
|
| |
- def test_json_set_translator_for_json(app, status, warning):
|
| |
- translator_class = app.builder.get_translator_class()
|
| |
- diff --git a/tests/test_build_html.py b/tests/test_build_html.py
|
| |
- index 07f101d..c512a33 100644
|
| |
- --- a/tests/test_build_html.py
|
| |
- +++ b/tests/test_build_html.py
|
| |
- @@ -1544,6 +1544,7 @@ def test_html_math_renderer_is_imgmath(app, status, warning):
|
| |
+ pargs: dict[int, Any] = {}
|
| |
+ diff --git a/tests/test_builders/test_build_html_maths.py b/tests/test_builders/test_build_html_maths.py
|
| |
+ index 900846b..664c86e 100644
|
| |
+ --- a/tests/test_builders/test_build_html_maths.py
|
| |
+ +++ b/tests/test_builders/test_build_html_maths.py
|
| |
+ @@ -20,6 +20,7 @@ def test_html_math_renderer_is_imgmath(app, status, warning):
|
| |
assert app.builder.math_renderer_name == 'imgmath'
|
| |
|
| |
|
| |
@@ -183,7 +164,7 @@
|
| |
@pytest.mark.sphinx('html', testroot='basic',
|
| |
confoverrides={'extensions': ['sphinxcontrib.jsmath',
|
| |
'sphinx.ext.imgmath']})
|
| |
- @@ -1564,6 +1565,7 @@ def test_html_math_renderer_is_duplicated2(app, status, warning):
|
| |
+ @@ -40,6 +41,7 @@ def test_html_math_renderer_is_duplicated2(app, status, warning):
|
| |
assert app.builder.math_renderer_name == 'imgmath' # The another one is chosen
|
| |
|
| |
|
| |
@@ -191,7 +172,7 @@
|
| |
@pytest.mark.sphinx('html', testroot='basic',
|
| |
confoverrides={'extensions': ['sphinxcontrib.jsmath',
|
| |
'sphinx.ext.imgmath'],
|
| |
- @@ -1572,6 +1574,7 @@ def test_html_math_renderer_is_chosen(app, status, warning):
|
| |
+ @@ -48,6 +50,7 @@ def test_html_math_renderer_is_chosen(app, status, warning):
|
| |
assert app.builder.math_renderer_name == 'imgmath'
|
| |
|
| |
|
| |
@@ -199,6 +180,26 @@
|
| |
@pytest.mark.sphinx('html', testroot='basic',
|
| |
confoverrides={'extensions': ['sphinxcontrib.jsmath',
|
| |
'sphinx.ext.mathjax'],
|
| |
+ diff --git a/tests/test_writers/test_api_translator.py b/tests/test_writers/test_api_translator.py
|
| |
+ index 9f2bd44..81575b7 100644
|
| |
+ --- a/tests/test_writers/test_api_translator.py
|
| |
+ +++ b/tests/test_writers/test_api_translator.py
|
| |
+ @@ -36,6 +36,7 @@ def test_singlehtml_set_translator_for_singlehtml(app, status, warning):
|
| |
+ assert translator_class.__name__ == 'ConfSingleHTMLTranslator'
|
| |
+
|
| |
+
|
| |
+ +@pytest.mark.sphinxcontrib('serializinghtml')
|
| |
+ @pytest.mark.sphinx('pickle', testroot='api-set-translator')
|
| |
+ def test_pickle_set_translator_for_pickle(app, status, warning):
|
| |
+ translator_class = app.builder.get_translator_class()
|
| |
+ @@ -43,6 +44,7 @@ def test_pickle_set_translator_for_pickle(app, status, warning):
|
| |
+ assert translator_class.__name__ == 'ConfPickleTranslator'
|
| |
+
|
| |
+
|
| |
+ +@pytest.mark.sphinxcontrib('serializinghtml')
|
| |
+ @pytest.mark.sphinx('json', testroot='api-set-translator')
|
| |
+ def test_json_set_translator_for_json(app, status, warning):
|
| |
+ translator_class = app.builder.get_translator_class()
|
| |
--
|
| |
- 2.43.0
|
| |
+ 2.44.0
|
| |
|
| |