public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/sphinxcontrib-jquery/, dev-python/sphinxcontrib-jquery/files/
@ 2023-11-24  9:31 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2023-11-24  9:31 UTC (permalink / raw
  To: gentoo-commits

commit:     c478fe42f9141e9900d3ebc35db8fd3549dce511
Author:     Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Thu Nov 23 23:45:06 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 24 09:30:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c478fe42

dev-python/sphinxcontrib-jquery: add patch for sphinx compat

See: https://github.com/sphinx-contrib/jquery/pull/28
Closes: https://bugs.gentoo.org/911837
Signed-off-by: Matoro Mahri <matoro_gentoo <AT> matoro.tk>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../sphinxcontrib-jquery-4.1-backport-pr28.patch   | 102 +++++++++++++++++++++
 .../sphinxcontrib-jquery-4.1.ebuild                |   2 +
 2 files changed, 104 insertions(+)

diff --git a/dev-python/sphinxcontrib-jquery/files/sphinxcontrib-jquery-4.1-backport-pr28.patch b/dev-python/sphinxcontrib-jquery/files/sphinxcontrib-jquery-4.1-backport-pr28.patch
new file mode 100644
index 000000000000..b9b10eb793c7
--- /dev/null
+++ b/dev-python/sphinxcontrib-jquery/files/sphinxcontrib-jquery-4.1-backport-pr28.patch
@@ -0,0 +1,102 @@
+https://bugs.gentoo.org/911837
+https://github.com/sphinx-contrib/jquery/pull/28
+
+From ac97ce5202b05ddb6bf4e5b77151a8964b6bf632 Mon Sep 17 00:00:00 2001
+From: Dmitry Shachnev <mitya57@gmail.com>
+Date: Mon, 31 Jul 2023 15:22:24 +0300
+Subject: [PATCH 1/3] 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(-)
+
+diff --git a/tests/test_jquery_installed.py b/tests/test_jquery_installed.py
+index a402bd4..08c25ba 100644
+--- 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 ('<script '
+             'integrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" '
+-            'src="_static/jquery.js"></script>') in text
++            f'src="_static/jquery.js{checksum}"></script>') in text
++    checksum = '?v=2cd50e6c' if sphinx.version_info[:2] >= (7, 1) else ''
+     assert ('<script '
+             'integrity="sha384-lSZeSIVKp9myfKbDQ3GkN/KHjUc+mzg17VKDN4Y2kUeBSJioB9QSM639vM9fuY//" '
+-            'src="_static/_sphinx_javascript_frameworks_compat.js"></script>') in text
++            f'src="_static/_sphinx_javascript_frameworks_compat.js{checksum}"></script>') 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 ('<script '
+-            'src="_static/jquery.js"></script>') in text
++            f'src="_static/jquery.js{checksum}"></script>') in text
++    checksum = '?v=2cd50e6c' if sphinx.version_info[:2] >= (7, 1) else ''
+     assert ('<script '
+-            'src="_static/_sphinx_javascript_frameworks_compat.js"></script>') in text
++            f'src="_static/_sphinx_javascript_frameworks_compat.js{checksum}"></script>') in text
+ 
+     static_dir = out_dir / '_static'
+     assert static_dir.joinpath('jquery.js').is_file()
+
+From 3318a82854fccec528cd73e12ab2ab96d8e71064 Mon Sep 17 00:00:00 2001
+From: Karolina Surma <ksurma@redhat.com>
+Date: Thu, 2 Nov 2023 10:44:24 +0100
+Subject: [PATCH 2/3] Enable testing with Sphinx 7.2+
+
+Since Sphinx is heading towards the standard Path objects, there's
+no need to monkeypatch the attributes anymore: the Path.resolve()
+method does the relevant work for us.
+---
+ tests/test_jquery_installed.py | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/tests/test_jquery_installed.py b/tests/test_jquery_installed.py
+index 08c25ba..32012e3 100644
+--- a/tests/test_jquery_installed.py
++++ b/tests/test_jquery_installed.py
+@@ -4,11 +4,18 @@
+ 
+ import pytest
+ import sphinx
+-from sphinx.testing.path import path
+ from sphinx.testing.util import SphinxTestApp
++from packaging.version import parse
+ 
+ from sphinxcontrib.jquery import _FILES, _ROOT_DIR  # NoQA
+ 
++last_with_legacy = parse("7.1.2")
++if parse(sphinx.__version__) > last_with_legacy:
++    test_path = Path
++else:
++    from sphinx.testing.path import path
++    test_path = path
++
+ 
+ def run_blank_app(srcdir, **kwargs):
+     Path(srcdir, "conf.py").write_text("", encoding="ascii")
+@@ -26,9 +33,11 @@ def run_blank_app(srcdir, **kwargs):
+ @pytest.fixture(scope="function")
+ def blank_app(tmpdir, monkeypatch):
+     def inner(**kwargs):
+-        return run_blank_app(path(tmpdir), **kwargs)
++        return run_blank_app(test_path(tmpdir), **kwargs)
+ 
+-    monkeypatch.setattr("sphinx.application.abspath", lambda x: x)
++    # Sphinx 7.2.x doesn't have abspath
++    if hasattr(sphinx.application, "abspath"):
++        monkeypatch.setattr("sphinx.application.abspath", lambda x: x)
+     yield inner
+ 
+ 
+

diff --git a/dev-python/sphinxcontrib-jquery/sphinxcontrib-jquery-4.1.ebuild b/dev-python/sphinxcontrib-jquery/sphinxcontrib-jquery-4.1.ebuild
index 1b08a94fffb4..6a63a04482f9 100644
--- a/dev-python/sphinxcontrib-jquery/sphinxcontrib-jquery-4.1.ebuild
+++ b/dev-python/sphinxcontrib-jquery/sphinxcontrib-jquery-4.1.ebuild
@@ -24,4 +24,6 @@ RDEPEND="
 	dev-python/sphinx[${PYTHON_USEDEP}]
 "
 
+PATCHES=( "${FILESDIR}/${PN}-4.1-backport-pr28.patch" )
+
 distutils_enable_tests pytest


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-24  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-24  9:31 [gentoo-commits] repo/gentoo:master commit in: dev-python/sphinxcontrib-jquery/, dev-python/sphinxcontrib-jquery/files/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox