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 1/2] distutils-r1.eclass: Prefer "rm -rf build" over "setup.py clean -a"
Date: Sat, 09 Apr 2022 16:38:19
Message-Id: 20220409163751.89200-1-mgorny@gentoo.org
1 Prefer using "rm -rf build" directly over "setup.py clean -a". This
2 has three advantages:
3
4 1. It is much faster.
5
6 2. It works on packages that have broken "setup.py clean",
7 e.g. dev-python/pydantic.
8
9 3. It works on packages that block "setup.py clean" and tell you to use
10 "git clean" (sic!), e.g. dev-python/scipy.
11
12 This is a potentially (but unlikely) breaking change, so do it
13 conditionally to GPEP517_TESTING.
14
15 Signed-off-by: Michał Górny <mgorny@g.o>
16 ---
17 eclass/distutils-r1.eclass | 6 +++++-
18 1 file changed, 5 insertions(+), 1 deletion(-)
19
20 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
21 index de891215e688..e6b0ab5e0e32 100644
22 --- a/eclass/distutils-r1.eclass
23 +++ b/eclass/distutils-r1.eclass
24 @@ -1090,7 +1090,11 @@ distutils_pep517_install() {
25 # clean the build tree; otherwise we may end up with PyPy3
26 # extensions duplicated into CPython dists
27 if [[ ${DISTUTILS_USE_PEP517:-setuptools} == setuptools ]]; then
28 - esetup.py clean -a
29 + if [[ ${GPEP517_TESTING} ]]; then
30 + rm -rf build || die
31 + else
32 + esetup.py clean -a
33 + fi
34 fi
35 }
36
37 --
38 2.35.1

Replies