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 (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E9286158042 for ; Tue, 12 Nov 2024 17:21:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 08C05E07EA; Tue, 12 Nov 2024 17:21:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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 C178AE07A9 for ; Tue, 12 Nov 2024 17:21:22 +0000 (UTC) From: Eli Schwartz To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [PATCH 1/2] distutils-r1.eclass: disable setuptools validation of pypi.org allowed strings Date: Tue, 12 Nov 2024 12:21:07 -0500 Message-ID: <20241112172117.2176777-1-eschwartz@gentoo.org> X-Mailer: git-send-email 2.45.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 9da01a30-9176-4a92-a745-158754b723ed X-Archives-Hash: 31e7ee47abccd7b49369f1023237ef0c Trove classifiers, and their officialness, have no effect on a wheel other than determining whether they are allowed to be uploaded to a non-Gentoo website, and enabling the search index of that other site. We don't need this, and we don't need to validate it. Setuptools will disable validation if both of: - network downloads failed - cannot successfully import the `trove_classifiers` module occurs. If trove-classifiers is installed by coincidence, this breaks builds when it doesn't get updated on an extremely rapid basis and some random package in dev-python/* uses a classifier that was made official just the other day. We could solve this another way, by making dev-python/setuptools PDEPEND on trove-classifiers, and constantly bump the >= dependency. But this is a pointless hassle. In fact, we're actually doing it, and it's been a pointless hassle. We need to maintain up-to-the-minute minimum bounds on the very latest version, and bump setuptools to a new -rX just to update the minimum version of a package it doesn't even depend on. We need to package new versions of trove-classifiers before *other* Gentoo Devs outside of the python project, can successfully revbump their own packages. We need to coordinate stabilization of trove-classifiers in combination with those other packages. We force people to install a pointless package. We overuse PDEPEND. Instead, prevent the module from being successfully imported if the package being built, doesn't actually depend on it. Then we don't actually need it to be installed, and all is well. This can be done at the small cost of installing a fake "trove_classifiers" module and mutating PYTHONPATH. It is inelegant and meh, but upstream has stated that they will not implement a real fix. Bug: https://github.com/pypa/setuptools/issues/4459 Signed-off-by: Eli Schwartz --- eclass/distutils-r1.eclass | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 7ab8dcae3265..9b9ba4b803ac 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -1360,6 +1360,17 @@ distutils_pep517_install() { EOF ) fi + if [[ ${BDEPEND} != *dev-python/trove-classifiers* ]]; then + # setuptools will try to import this package, if it is installed, + # and run validations we don't need or want that depend on + # having the most recent trove_classifiers version installed. + # + # https://github.com/pypa/setuptools/issues/4459 + cat >> "${T}/trove_classifiers.py" <<-EOF || die + raise ImportError("hide real trove_classifiers") + EOF + local -x PYTHONPATH="${T}${PYTHONPATH+:${PYTHONPATH}}" + fi ;; sip) if [[ -n ${DISTUTILS_ARGS[@]} ]]; then -- 2.45.2