commit:     bed1bdc8ecb1a2a3503da106ff1d29a7f2cc2a66
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 23 14:30:36 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Apr 23 14:33:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bed1bdc8

dev-python/myst-parser: Backport a Sphinx 7.3 fix

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/myst-parser-2.0.0-sphinx-7.3.patch       | 81 ++++++++++++++++++++++
 dev-python/myst-parser/myst-parser-2.0.0-r1.ebuild | 24 ++-----
 2 files changed, 88 insertions(+), 17 deletions(-)

diff --git a/dev-python/myst-parser/files/myst-parser-2.0.0-sphinx-7.3.patch 
b/dev-python/myst-parser/files/myst-parser-2.0.0-sphinx-7.3.patch
new file mode 100644
index 000000000000..3b9d9551311e
--- /dev/null
+++ b/dev-python/myst-parser/files/myst-parser-2.0.0-sphinx-7.3.patch
@@ -0,0 +1,81 @@
+diff --git a/tests/test_renderers/test_fixtures_sphinx.py 
b/tests/test_renderers/test_fixtures_sphinx.py
+index bd0f85eb..65aba83a 100644
+--- a/tests/test_renderers/test_fixtures_sphinx.py
++++ b/tests/test_renderers/test_fixtures_sphinx.py
+@@ -22,7 +22,12 @@
+ def test_syntax_elements(file_params, sphinx_doctree_no_tr: CreateDoctree):
+     sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]})
+     result = sphinx_doctree_no_tr(file_params.content, "index.md")
+-    file_params.assert_expected(result.pformat("index"), rstrip_lines=True)
++    pformat = result.pformat("index")
++    # changed in docutils 0.20.1
++    pformat = pformat.replace(
++        '<literal classes="code" language="">', '<literal classes="code">'
++    )
++    file_params.assert_expected(pformat, rstrip_lines=True)
+ 
+ 
+ @pytest.mark.param_file(FIXTURE_PATH / "sphinx_link_resolution.md")
+@@ -100,6 +105,8 @@ def test_sphinx_directives(file_params, 
sphinx_doctree_no_tr: CreateDoctree):
+         ),
+         "",
+     )
++    # changed in sphinx 7.3
++    pformat = pformat.replace("Added in version 0.2", "New in version 0.2")
+ 
+     file_params.assert_expected(pformat, rstrip_lines=True)
+ 
+diff --git a/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py 
b/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py
+index f6612b4c..33aed04b 100644
+--- a/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py
++++ b/tests/test_sphinx/sourcedirs/heading_slug_func/conf.py
+@@ -2,5 +2,6 @@
+ 
+ extensions = ["myst_parser"]
+ exclude_patterns = ["_build"]
++suppress_warnings = ["config.cache"]
+ myst_heading_anchors = 2
+ myst_heading_slug_func = make_id
+diff --git a/tests/test_sphinx/test_sphinx_builds.py 
b/tests/test_sphinx/test_sphinx_builds.py
+index fcc1e463..b4e7c10d 100644
+--- a/tests/test_sphinx/test_sphinx_builds.py
++++ b/tests/test_sphinx/test_sphinx_builds.py
+@@ -162,7 +162,12 @@ def test_references_singlehtml(
+             docname="other/other",
+             resolve=True,
+             regress=True,
+-            replace={"other\\other.md": "other/other.md"},
++            replace={
++                "other\\other.md": "other/other.md",
++                # changed in sphinx 7.3
++                '="#document-index': '="index.html#document-index',
++                '="#document-other': '="index.html#document-other',
++            },
+         )
+ 
+     get_sphinx_app_output(
+@@ -170,7 +175,12 @@ def test_references_singlehtml(
+         filename="index.html",
+         buildername="singlehtml",
+         regress_html=True,
+-        replace={"Permalink to this headline": "Permalink to this heading"},
++        replace={
++            "Permalink to this headline": "Permalink to this heading",
++            # changed in sphinx 7.3
++            '="#document-index': '="index.html#document-index',
++            '="#document-other': '="index.html#document-other',
++        },
+     )
+ 
+ 
+@@ -469,7 +479,9 @@ def test_gettext_html(
+         regress_ext=".html",
+         replace={
+             # upstream bug https://github.com/sphinx-doc/sphinx/issues/11689
+-            '"Permalink to this heading"': '"Lien permanent vers cette 
rubrique"'
++            '"Permalink to this heading"': '"Lien permanent vers cette 
rubrique"',
++            # which was fixed to a different translation in sphinx 7.3
++            '"Lien vers cette rubrique"': '"Lien permanent vers cette 
rubrique"',
+         },
+     )
+ 

diff --git a/dev-python/myst-parser/myst-parser-2.0.0-r1.ebuild 
b/dev-python/myst-parser/myst-parser-2.0.0-r1.ebuild
index 7d5eb87dbe12..4257951ca376 100644
--- a/dev-python/myst-parser/myst-parser-2.0.0-r1.ebuild
+++ b/dev-python/myst-parser/myst-parser-2.0.0-r1.ebuild
@@ -40,6 +40,7 @@ RDEPEND="
 BDEPEND="
        test? (
                dev-python/beautifulsoup4[${PYTHON_USEDEP}]
+               dev-python/defusedxml[${PYTHON_USEDEP}]
                <dev-python/linkify-it-py-3[${PYTHON_USEDEP}]
                >=dev-python/linkify-it-py-2.0.0[${PYTHON_USEDEP}]
                dev-python/pytest-regressions[${PYTHON_USEDEP}]
@@ -56,26 +57,15 @@ src_prepare() {
                # https://github.com/executablebooks/MyST-Parser/pull/811
                "${DISTDIR}/${P}-sphinx-7.2.patch"
        )
+       if has_version '>=dev-python/sphinx-7.3'; then
+               PATCHES+=(
+                       # 
https://github.com/executablebooks/MyST-Parser/pull/915
+                       "${FILESDIR}/${P}-sphinx-7.3.patch"
+               )
+       fi
 
        default
 
        # unpin docutils
        sed -i -e '/docutils/s:,<[0-9.]*::' pyproject.toml || die
 }
-
-python_test() {
-       local EPYTEST_DESELECT=()
-
-       if has_version ">=dev-python/sphinx-7.3"; then
-               EPYTEST_DESELECT+=(
-                       # 
https://github.com/executablebooks/MyST-Parser/issues/913
-                       
'tests/test_renderers/test_fixtures_sphinx.py::test_syntax_elements[298-Sphinx 
Role containing backtick:]'
-                       
'tests/test_renderers/test_fixtures_sphinx.py::test_sphinx_directives[341-versionadded
 (`sphinx.domains.changeset.VersionChange`):]'
-                       
tests/test_sphinx/test_sphinx_builds.py::test_references_singlehtml
-                       
tests/test_sphinx/test_sphinx_builds.py::test_heading_slug_func
-                       
tests/test_sphinx/test_sphinx_builds.py::test_gettext_html
-               )
-       fi
-
-       epytest
-}

Reply via email to