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: Call build_ext instead of build in PEP517 mode
Date: Sat, 09 Apr 2022 21:58:50
Message-Id: 20220409215820.241220-1-mgorny@gentoo.org
1 Call `setup.py build_ext` instead of the wholesale `build` in PEP517
2 mode. After all, the call is not strictly necessary; it is only done
3 in order to build C extensions in parallel (PEP517 backend does not
4 support specifying job count). By skipping the other tasks build
5 command does (and then repeats via PEP517 call), the ebuild can build
6 a few seconds faster.
7
8 Since this is a potentially breaking change (but very unlikely to
9 actually break anything), let's test it behind GPEP517_TESTING.
10
11 Signed-off-by: Michał Górny <mgorny@g.o>
12 ---
13 eclass/distutils-r1.eclass | 6 +++++-
14 1 file changed, 5 insertions(+), 1 deletion(-)
15
16 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
17 index cf6998e2680e..1a0097647c41 100644
18 --- a/eclass/distutils-r1.eclass
19 +++ b/eclass/distutils-r1.eclass
20 @@ -1132,7 +1132,11 @@ distutils-r1_python_compile() {
21 jobs=$(( nproc + 1 ))
22 fi
23
24 - esetup.py build -j "${jobs}" "${@}"
25 + if [[ ${DISTUTILS_USE_PEP517} && ${GPEP517_TESTING} ]]; then
26 + esetup.py build_ext -j "${jobs}" "${@}"
27 + else
28 + esetup.py build -j "${jobs}" "${@}"
29 + fi
30 fi
31
32 if [[ ${DISTUTILS_USE_PEP517} ]]; then
33 --
34 2.35.1

Replies