Call `setup.py build_ext` instead of the wholesale `build` in PEP517
mode.  After all, the call is not strictly necessary; it is only done
in order to build C extensions in parallel (PEP517 backend does not
support specifying job count).  By skipping the other tasks build
command does (and then repeats via PEP517 call), the ebuild can build
a few seconds faster.

Since this is a potentially breaking change (but very unlikely to
actually break anything), let's test it behind GPEP517_TESTING.

Signed-off-by: Michał Górny <[email protected]>
---
 eclass/distutils-r1.eclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index cf6998e2680e..1a0097647c41 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1132,7 +1132,11 @@ distutils-r1_python_compile() {
                        jobs=$(( nproc + 1 ))
                fi
 
-               esetup.py build -j "${jobs}" "${@}"
+               if [[ ${DISTUTILS_USE_PEP517} && ${GPEP517_TESTING} ]]; then
+                       esetup.py build_ext -j "${jobs}" "${@}"
+               else
+                       esetup.py build -j "${jobs}" "${@}"
+               fi
        fi
 
        if [[ ${DISTUTILS_USE_PEP517} ]]; then
-- 
2.35.1


Reply via email to