From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0EAD1158064 for ; Sat, 11 May 2024 19:11:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 38EADE29E7; Sat, 11 May 2024 19:11:54 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1C33DE29E7 for ; Sat, 11 May 2024 19:11:54 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4BC89343079 for ; Sat, 11 May 2024 19:11:53 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B002C93E for ; Sat, 11 May 2024 19:11:51 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1715454661.01f1140e16b69956b2d6171e0a503c043296fb14.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/sphinx/files/, dev-python/sphinx/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/sphinx/files/sphinx-7.3.7-opt-defusedxml.patch dev-python/sphinx/sphinx-7.3.7-r1.ebuild dev-python/sphinx/sphinx-7.3.7-r2.ebuild X-VCS-Directories: dev-python/sphinx/files/ dev-python/sphinx/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 01f1140e16b69956b2d6171e0a503c043296fb14 X-VCS-Branch: master Date: Sat, 11 May 2024 19:11:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: dd6a13b3-ad38-483e-b5d7-07972c6c100e X-Archives-Hash: 89f6f94169ed731d5eadb0c2f68fddd1 commit: 01f1140e16b69956b2d6171e0a503c043296fb14 Author: Michał Górny gentoo org> AuthorDate: Sat May 11 19:05:25 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Sat May 11 19:11:01 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01f1140e dev-python/sphinx: Make dev-python/defusedxml import optional Closes: https://bugs.gentoo.org/931580 Signed-off-by: Michał Górny gentoo.org> .../sphinx/files/sphinx-7.3.7-opt-defusedxml.patch | 34 ++++++++++++++++++++++ ...hinx-7.3.7-r1.ebuild => sphinx-7.3.7-r2.ebuild} | 7 ++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/dev-python/sphinx/files/sphinx-7.3.7-opt-defusedxml.patch b/dev-python/sphinx/files/sphinx-7.3.7-opt-defusedxml.patch new file mode 100644 index 000000000000..cb70e2cf89fc --- /dev/null +++ b/dev-python/sphinx/files/sphinx-7.3.7-opt-defusedxml.patch @@ -0,0 +1,34 @@ +From ce86026f3b667949ef39f7fdab9a40941d99c5ca Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sat, 11 May 2024 18:31:02 +0200 +Subject: [PATCH] DEPS: Lazy import `defusedxml` only when necessary (#12362) + +The `defusedxml` dependency was added to `sphinx.testing` in sphinx 7.3, +but it is not part of the core sphinx dependencies, and not strictly necessary for the running of the pytest plugin. +This commit moves the import into the only function which uses it, +so that the pytest plugins can be used again without this dependency. +--- + sphinx/testing/util.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sphinx/testing/util.py b/sphinx/testing/util.py +index d1de8ea2b7..b2df709eea 100644 +--- a/sphinx/testing/util.py ++++ b/sphinx/testing/util.py +@@ -11,7 +11,6 @@ + from types import MappingProxyType + from typing import TYPE_CHECKING + +-from defusedxml.ElementTree import parse as xml_parse + from docutils import nodes + from docutils.parsers.rst import directives, roles + +@@ -73,6 +72,8 @@ def assert_node(node: Node, cls: Any = None, xpath: str = "", **kwargs: Any) -> + # keep this to restrict the API usage and to have a correct return type + def etree_parse(path: str | os.PathLike[str]) -> ElementTree: + """Parse a file into a (safe) XML element tree.""" ++ from defusedxml.ElementTree import parse as xml_parse ++ + return xml_parse(path) + + diff --git a/dev-python/sphinx/sphinx-7.3.7-r1.ebuild b/dev-python/sphinx/sphinx-7.3.7-r2.ebuild similarity index 96% rename from dev-python/sphinx/sphinx-7.3.7-r1.ebuild rename to dev-python/sphinx/sphinx-7.3.7-r2.ebuild index 4151e90e6efc..99ff0e4980f7 100644 --- a/dev-python/sphinx/sphinx-7.3.7-r1.ebuild +++ b/dev-python/sphinx/sphinx-7.3.7-r2.ebuild @@ -52,11 +52,6 @@ RDEPEND=" ) !dev-python/namespace-sphinxcontrib " -# added temporarily because of unconditional import in sphinx.testing.util -# until we figure out how to deal with it better -RDEPEND+=" - dev-python/defusedxml[${PYTHON_USEDEP}] -" BDEPEND=" doc? ( dev-python/sphinxcontrib-websupport[${PYTHON_USEDEP}] @@ -77,6 +72,8 @@ BDEPEND=" PATCHES=( "${FILESDIR}/sphinx-3.2.1-doc-link.patch" "${FILESDIR}/sphinx-4.3.2-doc-link.patch" + # https://github.com/sphinx-doc/sphinx/pull/12362 + "${FILESDIR}/${P}-opt-defusedxml.patch" ) distutils_enable_tests pytest