commit:     e89cf18aecc88e4504f0ac4d848285a5ca3901db
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 30 06:33:34 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Nov 30 06:33:34 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e89cf18a

dev-python/setuptools: Revert "allow disabling validation ..."

Revert unauthorized and uncommunicated changes.

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

 ...edgeable-users-to-disable-validating-trov.patch | 65 ----------------------
 ...tuptools-75.6.0-disable-trove-classifiers.patch | 32 +++++++++++
 ...4.1.3-r2.ebuild => setuptools-74.1.3-r1.ebuild} |  7 ++-
 ...s-75.5.0-r1.ebuild => setuptools-75.5.0.ebuild} |  7 ++-
 ...5.6.0-r2.ebuild => setuptools-75.6.0-r1.ebuild} |  9 ++-
 5 files changed, 52 insertions(+), 68 deletions(-)

diff --git 
a/dev-python/setuptools/files/0001-Allow-knowledgeable-users-to-disable-validating-trov.patch
 
b/dev-python/setuptools/files/0001-Allow-knowledgeable-users-to-disable-validating-trov.patch
deleted file mode 100644
index 4ab6bbae7af4..000000000000
--- 
a/dev-python/setuptools/files/0001-Allow-knowledgeable-users-to-disable-validating-trov.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From f694e474ab3c45af6241a3f2bf575f8188e9cbea Mon Sep 17 00:00:00 2001
-From: Eli Schwartz <[email protected]>
-Date: Mon, 11 Nov 2024 19:51:54 -0500
-Subject: [PATCH] Allow knowledgeable users to disable validating
- trove-classifiers
-
-Classifiers are based on a "blessed list" of search terms that are
-allowed on https://pypi.org and need to be regularly kept up to date in
-order to validate them.
-
-Many people don't care about this. Arguably, *no one* cares about this,
-since wheels that have search terms that PyPI doesn't consider popular
-enough will simply fail uploading to PyPI. But also, not everyone wants
-to download new lists of "allowed words" from the internet every time
-they check to see if e.g. pyproject.toml contains a valid format that
-won't traceback when someone tries to read the "name" field and gets an
-integer instead of a string. Or their entrypoints are malformed because
-they aren't a valid python object reference.
-
-This is also an issue because one might have an old version of the
-classifiers cached, and then a new classifier is added to
-https://pypi.org and you want to use it immediately, and the local
-validator in the form of validate_pyproject fails but actually uploading
-a wheel to https://pypi.org would work fine.
-
-Signed-off-by: Eli Schwartz <[email protected]>
-Signed-off-by: Eli Schwartz <[email protected]>
----
- .../config/_validate_pyproject/formats.py      | 18 +++++++++++-------
- 1 file changed, 11 insertions(+), 7 deletions(-)
-
-diff --git a/setuptools/config/_validate_pyproject/formats.py 
b/setuptools/config/_validate_pyproject/formats.py
-index 153b1f0b2..50b8520e9 100644
---- a/setuptools/config/_validate_pyproject/formats.py
-+++ b/setuptools/config/_validate_pyproject/formats.py
-@@ -205,15 +205,19 @@ class _TroveClassifier:
-         return value in self.downloaded or value.lower().startswith("private 
::")
- 
- 
--try:
--    from trove_classifiers import classifiers as _trove_classifiers
--
-+if os.getenv("GENTOO_VALIDATE_PYPROJECT_NO_TROVE_CLASSIFIERS"):
-     def trove_classifier(value: str) -> bool:
--        """See https://pypi.org/classifiers/""";
--        return value in _trove_classifiers or 
value.lower().startswith("private ::")
-+        return True
-+else:
-+    try:
-+        from trove_classifiers import classifiers as _trove_classifiers
- 
--except ImportError:  # pragma: no cover
--    trove_classifier = _TroveClassifier()
-+        def trove_classifier(value: str) -> bool:
-+            """See https://pypi.org/classifiers/""";
-+            return value in _trove_classifiers or 
value.lower().startswith("private ::")
-+
-+    except ImportError:  # pragma: no cover
-+        trove_classifier = _TroveClassifier()
- 
- 
- # 
-------------------------------------------------------------------------------------
--- 
-2.45.2
-

diff --git 
a/dev-python/setuptools/files/setuptools-75.6.0-disable-trove-classifiers.patch 
b/dev-python/setuptools/files/setuptools-75.6.0-disable-trove-classifiers.patch
new file mode 100644
index 000000000000..c5111e985f61
--- /dev/null
+++ 
b/dev-python/setuptools/files/setuptools-75.6.0-disable-trove-classifiers.patch
@@ -0,0 +1,32 @@
+From 0d9e8bc7d6df86381ac56770dc95fc75276f49ef Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Thu, 21 Nov 2024 20:40:14 +0100
+Subject: [PATCH] Add an option to disable using trove-classifiers package
+
+As requested in https://github.com/pypa/setuptools/issues/4459, add
+a VALIDATE_PYPROJECT_NO_TROVE_CLASSIFIERS environment variable that can
+be used to disable using trove_classifiers package even if it is
+available.  This can be used when the system features an outdated
+trove_classifiers, and therefore incorrectly triggers validation error.
+The change is designed to be absolutely minimal and non-intrusive.
+---
+ setuptools/config/_validate_pyproject/formats.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/setuptools/config/_validate_pyproject/formats.py 
b/setuptools/config/_validate_pyproject/formats.py
+index aacf4092b..0b05ab17b 100644
+--- a/setuptools/config/_validate_pyproject/formats.py
++++ b/setuptools/config/_validate_pyproject/formats.py
+@@ -210,6 +210,9 @@ try:
+         """See https://pypi.org/classifiers/""";
+         return value in _trove_classifiers or 
value.lower().startswith("private ::")
+ 
++    if os.getenv("VALIDATE_PYPROJECT_NO_TROVE_CLASSIFIERS"):  # pragma: no 
cover
++        raise ImportError()
++
+ except ImportError:  # pragma: no cover
+     trove_classifier = _TroveClassifier()
+ 
+-- 
+2.47.0
+

diff --git a/dev-python/setuptools/setuptools-74.1.3-r2.ebuild 
b/dev-python/setuptools/setuptools-74.1.3-r1.ebuild
similarity index 93%
rename from dev-python/setuptools/setuptools-74.1.3-r2.ebuild
rename to dev-python/setuptools/setuptools-74.1.3-r1.ebuild
index 62bcc9708b4a..9cc97e5921d2 100644
--- a/dev-python/setuptools/setuptools-74.1.3-r2.ebuild
+++ b/dev-python/setuptools/setuptools-74.1.3-r1.ebuild
@@ -64,15 +64,20 @@ BDEPEND="
 "
 # setuptools-scm is here because installing plugins apparently breaks stuff at
 # runtime, so let's pull it early. See bug #663324.
+#
+# trove-classifiers are optionally used in validation, if they are
+# installed.  Since we really oughtn't block them, let's always enforce
+# the newest version for the time being to avoid errors.
+# https://github.com/pypa/setuptools/issues/4459
 PDEPEND="
        dev-python/setuptools-scm[${PYTHON_USEDEP}]
+       >=dev-python/trove-classifiers-2024.10.16[${PYTHON_USEDEP}]
 "
 
 src_prepare() {
        local PATCHES=(
                # TODO: remove this when we're 100% PEP517 mode
                "${FILESDIR}/setuptools-62.4.0-py-compile.patch"
-               
"${FILESDIR}"/0001-Allow-knowledgeable-users-to-disable-validating-trov.patch
        )
 
        distutils-r1_src_prepare

diff --git a/dev-python/setuptools/setuptools-75.5.0-r1.ebuild 
b/dev-python/setuptools/setuptools-75.5.0.ebuild
similarity index 93%
rename from dev-python/setuptools/setuptools-75.5.0-r1.ebuild
rename to dev-python/setuptools/setuptools-75.5.0.ebuild
index 9e5a6fe7eb3f..8bd616a1e315 100644
--- a/dev-python/setuptools/setuptools-75.5.0-r1.ebuild
+++ b/dev-python/setuptools/setuptools-75.5.0.ebuild
@@ -66,15 +66,20 @@ BDEPEND="
 "
 # setuptools-scm is here because installing plugins apparently breaks stuff at
 # runtime, so let's pull it early. See bug #663324.
+#
+# trove-classifiers are optionally used in validation, if they are
+# installed.  Since we really oughtn't block them, let's always enforce
+# the newest version for the time being to avoid errors.
+# https://github.com/pypa/setuptools/issues/4459
 PDEPEND="
        dev-python/setuptools-scm[${PYTHON_USEDEP}]
+       >=dev-python/trove-classifiers-2024.10.16[${PYTHON_USEDEP}]
 "
 
 src_prepare() {
        local PATCHES=(
                # TODO: remove this when we're 100% PEP517 mode
                "${FILESDIR}/setuptools-62.4.0-py-compile.patch"
-               
"${FILESDIR}"/0001-Allow-knowledgeable-users-to-disable-validating-trov.patch
        )
 
        distutils-r1_src_prepare

diff --git a/dev-python/setuptools/setuptools-75.6.0-r2.ebuild 
b/dev-python/setuptools/setuptools-75.6.0-r1.ebuild
similarity index 90%
rename from dev-python/setuptools/setuptools-75.6.0-r2.ebuild
rename to dev-python/setuptools/setuptools-75.6.0-r1.ebuild
index 9e5a6fe7eb3f..a9961b9303cc 100644
--- a/dev-python/setuptools/setuptools-75.6.0-r2.ebuild
+++ b/dev-python/setuptools/setuptools-75.6.0-r1.ebuild
@@ -66,15 +66,22 @@ BDEPEND="
 "
 # setuptools-scm is here because installing plugins apparently breaks stuff at
 # runtime, so let's pull it early. See bug #663324.
+#
+# trove-classifiers are optionally used in validation, if they are
+# installed.  Since we really oughtn't block them, let's always enforce
+# the newest version for the time being to avoid errors.
+# https://github.com/pypa/setuptools/issues/4459
 PDEPEND="
        dev-python/setuptools-scm[${PYTHON_USEDEP}]
+       >=dev-python/trove-classifiers-2024.10.16[${PYTHON_USEDEP}]
 "
 
 src_prepare() {
        local PATCHES=(
                # TODO: remove this when we're 100% PEP517 mode
                "${FILESDIR}/setuptools-62.4.0-py-compile.patch"
-               
"${FILESDIR}"/0001-Allow-knowledgeable-users-to-disable-validating-trov.patch
+               # https://github.com/abravalheri/validate-pyproject/pull/221
+               "${FILESDIR}/setuptools-75.6.0-disable-trove-classifiers.patch"
        )
 
        distutils-r1_src_prepare

Reply via email to