Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] install-qa-check.d: do not request DISTUTILS_USE_SETUPTOOLS=no
Date: Sun, 09 Jan 2022 08:16:16
Message-Id: 20220109081548.123208-1-mgorny@gentoo.org
1 The Python distutils deprecation is for real, and nowadays setuptools
2 installs hacks that override distutils with their own bundled version.
3 For this reason, the check no longer works reliably and even if it were,
4 we will eventually be requiring setuptools on all Python packages.
5 Avoid asking people to set DISTUTILS_USE_SETUPTOOLS=no; allow either
6 "no" or "bdepend" for the time being.
7
8 Signed-off-by: Michał Górny <mgorny@g.o>
9 ---
10 metadata/install-qa-check.d/60distutils-use-setuptools | 8 +++++---
11 1 file changed, 5 insertions(+), 3 deletions(-)
12
13 diff --git a/metadata/install-qa-check.d/60distutils-use-setuptools b/metadata/install-qa-check.d/60distutils-use-setuptools
14 index a7905c3f0b2f..6b3d063c73cf 100644
15 --- a/metadata/install-qa-check.d/60distutils-use-setuptools
16 +++ b/metadata/install-qa-check.d/60distutils-use-setuptools
17 @@ -1,4 +1,4 @@
18 -# Copyright 2020-2021 Gentoo Authors
19 +# Copyright 2020-2022 Gentoo Authors
20 # Distributed under the terms of the GNU General Public License v2
21
22 # QA check: verify correctness of DISTUTILS_USE_SETUPTOOLS
23 @@ -63,6 +63,10 @@ distutils_use_setuptools_check() {
24 eerror "https://dev.gentoo.org/~mgorny/python-guide/distutils.html#conditional-distutils-setuptools-use-in-packages"
25 eerror "Please report a bug about this and CC python@"
26 else
27 + # now that distutils is deprecated and setuptools hacks its own
28 + # version in, the check no longer works reliably. just assume
29 + # either "bdepend" or "no" is fine for the time being
30 + [[ ${expected} == no ]] && expected+=( bdepend )
31 # if we did not find anything, also assume 'no' is desired,
32 # we do not want the setuptools dep
33 [[ ${#expected[@]} -eq 0 ]] && expected=( no )
34 @@ -71,8 +75,6 @@ distutils_use_setuptools_check() {
35 # NB: note that expected is overwritten above, so this implies !rdepend
36 # if the package is using entry points, modern versions of setuptools
37 # use built-in importlib.metadata module, so no rdep needed anymore
38 - # NB2: this is incorrect for pypy3.7 but we ignore this for the time
39 - # being
40 has entry-point "${expected[@]}" && expected=( bdepend )
41
42 if ! has ${DISTUTILS_USE_SETUPTOOLS} "${expected[@]}"; then
43 --
44 2.34.1

Replies