* [gentoo-dev] [PATCH 1/2] distutils-r1.eclass: Call build_ext instead of build in PEP517 mode
@ 2022-04-09 21:58 Michał Górny
2022-04-09 21:58 ` [gentoo-dev] [PATCH 2/2] distutils-r1.eclass: Skip build_ext when there no .c/.pyx files Michał Górny
0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2022-04-09 21:58 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
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 <mgorny@gentoo.org>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-dev] [PATCH 2/2] distutils-r1.eclass: Skip build_ext when there no .c/.pyx files
2022-04-09 21:58 [gentoo-dev] [PATCH 1/2] distutils-r1.eclass: Call build_ext instead of build in PEP517 mode Michał Górny
@ 2022-04-09 21:58 ` Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2022-04-09 21:58 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Skip issuing build_ext when there appears to be no .c/.pyx files.
Since starting setuptools is expensive, this gives a major speedup
to building pure Python packages. If the check misfires, the worst
that can happen is that C extensions will be built serialized.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/distutils-r1.eclass | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 1a0097647c41..4d9db7586371 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1133,7 +1133,12 @@ distutils-r1_python_compile() {
fi
if [[ ${DISTUTILS_USE_PEP517} && ${GPEP517_TESTING} ]]; then
- esetup.py build_ext -j "${jobs}" "${@}"
+ # issue build_ext only if it looks like we have something
+ # to build; setuptools is expensive to start
+ if [[ -n $(find '(' -name '*.c' -o -name '*.pyx' ')' -print -quit) ]]
+ then
+ esetup.py build_ext -j "${jobs}" "${@}"
+ fi
else
esetup.py build -j "${jobs}" "${@}"
fi
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-09 21:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-09 21:58 [gentoo-dev] [PATCH 1/2] distutils-r1.eclass: Call build_ext instead of build in PEP517 mode Michał Górny
2022-04-09 21:58 ` [gentoo-dev] [PATCH 2/2] distutils-r1.eclass: Skip build_ext when there no .c/.pyx files Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox