From 2a10bb29d097a1759b38896497abeb06f19bbab33c94e736dcb9e4f45c97c1ec Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 4 Sep 2023 10:53:25 +0000 Subject: [PATCH 1/2] - add tests-with-sphinx-71.patch to fix tests with sphinx 7.1+ OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sphinxcontrib-jquery?expand=0&rev=4 --- python-sphinxcontrib-jquery.changes | 5 ++++ python-sphinxcontrib-jquery.spec | 2 ++ tests-with-sphinx-71.patch | 45 +++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 tests-with-sphinx-71.patch diff --git a/python-sphinxcontrib-jquery.changes b/python-sphinxcontrib-jquery.changes index 56678e4..dbed4ec 100644 --- a/python-sphinxcontrib-jquery.changes +++ b/python-sphinxcontrib-jquery.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Sep 4 10:52:33 UTC 2023 - Dirk Müller + +- add tests-with-sphinx-71.patch to fix tests with sphinx 7.1+ + ------------------------------------------------------------------- Mon May 8 11:07:48 UTC 2023 - Torsten Gruner diff --git a/python-sphinxcontrib-jquery.spec b/python-sphinxcontrib-jquery.spec index 4cbd653..cdd8304 100644 --- a/python-sphinxcontrib-jquery.spec +++ b/python-sphinxcontrib-jquery.spec @@ -33,6 +33,8 @@ Summary: Extension to include jQuery on newer Sphinx releases License: 0BSD URL: https://github.com/sphinx-contrib/jquery/ Source: https://files.pythonhosted.org/packages/source/s/sphinxcontrib-jquery/sphinxcontrib-jquery-4.1.tar.gz +# Taken from https://github.com/sphinx-contrib/jquery/pull/26 +Patch1: tests-with-sphinx-71.patch BuildRequires: %{python_module flit-core} BuildRequires: %{python_module pip} BuildRequires: python-rpm-macros diff --git a/tests-with-sphinx-71.patch b/tests-with-sphinx-71.patch new file mode 100644 index 0000000..a380464 --- /dev/null +++ b/tests-with-sphinx-71.patch @@ -0,0 +1,45 @@ +From ac97ce5202b05ddb6bf4e5b77151a8964b6bf632 Mon Sep 17 00:00:00 2001 +From: Dmitry Shachnev +Date: Mon, 31 Jul 2023 15:22:24 +0300 +Subject: [PATCH] Make the tests pass with Sphinx 7.1 + +Fixes #25. +--- + .github/workflows/test.yml | 5 ++++- + tests/test_jquery_installed.py | 12 ++++++++---- + 2 files changed, 12 insertions(+), 5 deletions(-) + +--- a/tests/test_jquery_installed.py ++++ b/tests/test_jquery_installed.py +@@ -38,12 +38,14 @@ def test_jquery_installed_sphinx_ge_60_use_sri(blank_app): + out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"], "jquery_use_sri": True}) + + text = out_dir.joinpath("index.html").read_text(encoding="utf-8") ++ checksum = '?v=5d32c60e' if sphinx.version_info[:2] >= (7, 1) else '' + assert ('') in text ++ f'src="_static/jquery.js{checksum}">') in text ++ checksum = '?v=2cd50e6c' if sphinx.version_info[:2] >= (7, 1) else '' + assert ('') in text ++ f'src="_static/_sphinx_javascript_frameworks_compat.js{checksum}">') in text + + static_dir = out_dir / '_static' + assert static_dir.joinpath('jquery.js').is_file() +@@ -56,10 +58,12 @@ def test_jquery_installed_sphinx_ge_60(blank_app): + out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"]}) + + text = out_dir.joinpath("index.html").read_text(encoding="utf-8") ++ checksum = '?v=5d32c60e' if sphinx.version_info[:2] >= (7, 1) else '' + assert ('') in text ++ f'src="_static/jquery.js{checksum}">') in text ++ checksum = '?v=2cd50e6c' if sphinx.version_info[:2] >= (7, 1) else '' + assert ('') in text ++ f'src="_static/_sphinx_javascript_frameworks_compat.js{checksum}">') in text + + static_dir = out_dir / '_static' + assert static_dir.joinpath('jquery.js').is_file() From 7acfdf425c07855de3ad5a502eeb9e0c2012faf213b71b16a7d6b74ccfb9ebce Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Mon, 4 Sep 2023 12:09:33 +0000 Subject: [PATCH 2/2] - Add tests-with-sphinx-72.patch to fix tests with sphinx 7.2. gh#sphinx-contrib/jquery#27 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sphinxcontrib-jquery?expand=0&rev=5 --- python-sphinxcontrib-jquery.changes | 7 +++ python-sphinxcontrib-jquery.spec | 4 +- ...inx-71.patch => tests-with-sphinx-72.patch | 58 ++++++++++++++----- 3 files changed, 52 insertions(+), 17 deletions(-) rename tests-with-sphinx-71.patch => tests-with-sphinx-72.patch (55%) diff --git a/python-sphinxcontrib-jquery.changes b/python-sphinxcontrib-jquery.changes index dbed4ec..adc3dea 100644 --- a/python-sphinxcontrib-jquery.changes +++ b/python-sphinxcontrib-jquery.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 4 12:04:08 UTC 2023 - Daniel Garcia + +- remove tests-with-sphinx-71.patch. +- Add tests-with-sphinx-72.patch to fix tests with sphinx 7.2. + gh#sphinx-contrib/jquery#27 + ------------------------------------------------------------------- Mon Sep 4 10:52:33 UTC 2023 - Dirk Müller diff --git a/python-sphinxcontrib-jquery.spec b/python-sphinxcontrib-jquery.spec index cdd8304..884c3c4 100644 --- a/python-sphinxcontrib-jquery.spec +++ b/python-sphinxcontrib-jquery.spec @@ -33,8 +33,8 @@ Summary: Extension to include jQuery on newer Sphinx releases License: 0BSD URL: https://github.com/sphinx-contrib/jquery/ Source: https://files.pythonhosted.org/packages/source/s/sphinxcontrib-jquery/sphinxcontrib-jquery-4.1.tar.gz -# Taken from https://github.com/sphinx-contrib/jquery/pull/26 -Patch1: tests-with-sphinx-71.patch +# PATCH-FIX-UPSTREAM tests-with-sphinx-72.patch gh#sphinx-contrib/jquery#27 +Patch1: tests-with-sphinx-72.patch BuildRequires: %{python_module flit-core} BuildRequires: %{python_module pip} BuildRequires: python-rpm-macros diff --git a/tests-with-sphinx-71.patch b/tests-with-sphinx-72.patch similarity index 55% rename from tests-with-sphinx-71.patch rename to tests-with-sphinx-72.patch index a380464..b122dae 100644 --- a/tests-with-sphinx-71.patch +++ b/tests-with-sphinx-72.patch @@ -1,17 +1,45 @@ -From ac97ce5202b05ddb6bf4e5b77151a8964b6bf632 Mon Sep 17 00:00:00 2001 -From: Dmitry Shachnev -Date: Mon, 31 Jul 2023 15:22:24 +0300 -Subject: [PATCH] Make the tests pass with Sphinx 7.1 - -Fixes #25. ---- - .github/workflows/test.yml | 5 ++++- - tests/test_jquery_installed.py | 12 ++++++++---- - 2 files changed, 12 insertions(+), 5 deletions(-) - ---- a/tests/test_jquery_installed.py -+++ b/tests/test_jquery_installed.py -@@ -38,12 +38,14 @@ def test_jquery_installed_sphinx_ge_60_use_sri(blank_app): +Index: sphinxcontrib-jquery-4.1/tests/test_jquery_installed.py +=================================================================== +--- sphinxcontrib-jquery-4.1.orig/tests/test_jquery_installed.py ++++ sphinxcontrib-jquery-4.1/tests/test_jquery_installed.py +@@ -1,10 +1,9 @@ + import base64 + import hashlib +-from pathlib import Path ++from pathlib import Path, PosixPath + + import pytest + import sphinx +-from sphinx.testing.path import path + from sphinx.testing.util import SphinxTestApp + + from sphinxcontrib.jquery import _FILES, _ROOT_DIR # NoQA +@@ -23,12 +22,22 @@ def run_blank_app(srcdir, **kwargs): + return Path(srcdir, "_build", "html") + + ++class FakePath(PosixPath): ++ @classmethod ++ def _from_parts(cls, args, **kwargs): ++ cls._path = args[0] ++ return PosixPath._from_parts(args, **kwargs) ++ ++ def resolve(self, *args, **kwargs): ++ return self._path ++ ++ + @pytest.fixture(scope="function") + def blank_app(tmpdir, monkeypatch): + def inner(**kwargs): +- return run_blank_app(path(tmpdir), **kwargs) ++ return run_blank_app(Path(tmpdir), **kwargs) + +- monkeypatch.setattr("sphinx.application.abspath", lambda x: x) ++ monkeypatch.setattr("sphinx.application._StrPath", FakePath) + yield inner + + +@@ -38,12 +47,14 @@ def test_jquery_installed_sphinx_ge_60_u out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"], "jquery_use_sri": True}) text = out_dir.joinpath("index.html").read_text(encoding="utf-8") @@ -28,7 +56,7 @@ Fixes #25. static_dir = out_dir / '_static' assert static_dir.joinpath('jquery.js').is_file() -@@ -56,10 +58,12 @@ def test_jquery_installed_sphinx_ge_60(blank_app): +@@ -56,10 +67,12 @@ def test_jquery_installed_sphinx_ge_60(b out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"]}) text = out_dir.joinpath("index.html").read_text(encoding="utf-8")