summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-04-09 23:55:50 +0200
committerMichał Górny <mgorny@gentoo.org>2022-04-11 21:58:39 +0200
commit4986eb8eece688f596bbf6e2cbcbe532df07c95f (patch)
tree6a1f309399b8ed3b59bea664c4a279ad8d64eaa1 /eclass/distutils-r1.eclass
parentdistutils-r1.eclass: Call build_ext instead of build in PEP517 mode (diff)
downloadgentoo-4986eb8eece688f596bbf6e2cbcbe532df07c95f.tar.gz
gentoo-4986eb8eece688f596bbf6e2cbcbe532df07c95f.tar.bz2
gentoo-4986eb8eece688f596bbf6e2cbcbe532df07c95f.zip
distutils-r1.eclass: Skip build_ext when there no .c/.pyx files
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>
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass12
1 files changed, 11 insertions, 1 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 1a0097647c41..f9cb41aa3d42 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1133,7 +1133,17 @@ 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
+ # see extension.py for list of suffixes
+ # .pyx is added for Cython
+ if [[ -n $(
+ find '(' -name '*.c' -o -name '*.cc' -o -name '*.cpp' \
+ -o -name '*.cxx' -o -name '*.c++' -o -name '*.m' \
+ -o -name '*.mm' -o -name '*.pyx' ')' -print -quit
+ ) ]]; then
+ esetup.py build_ext -j "${jobs}" "${@}"
+ fi
else
esetup.py build -j "${jobs}" "${@}"
fi