summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-04-22 09:31:51 +0200
committerMichał Górny <mgorny@gentoo.org>2022-04-25 14:08:46 +0200
commit2e85852793d7d97f7eeb52641609302d73d4aabb (patch)
tree41fda2a96bb0d5aa3c3285f59000c2232bd37d8c /eclass/distutils-r1.eclass
parentdev-python/jedi: Bump to 0.18.1 (diff)
downloadgentoo-2e85852793d7d97f7eeb52641609302d73d4aabb.tar.gz
gentoo-2e85852793d7d97f7eeb52641609302d73d4aabb.tar.bz2
gentoo-2e85852793d7d97f7eeb52641609302d73d4aabb.zip
distutils-r1.eclass: Run build_ext only if there are 2+ files
Run parallel build_ext only if there are at least two potential source files to compile. This call is expensive and parallel builds do not benefit us if there is only one file to compile. 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, 8 insertions, 4 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 5528ff74cccf..d213cca4bb72 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1189,14 +1189,18 @@ distutils-r1_python_compile() {
fi
if [[ ${DISTUTILS_USE_PEP517} && ${GPEP517_TESTING} ]]; then
- # issue build_ext only if it looks like we have something
- # to build; setuptools is expensive to start
+ # issue build_ext only if it looks like we have at least
+ # two source files to build; setuptools is expensive
+ # to start and parallel builds can only benefit us if we're
+ # compiling at least two files
+ #
# see extension.py for list of suffixes
# .pyx is added for Cython
- if [[ -n $(
+ if [[ 2 -eq $(
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
+ -o -name '*.mm' -o -name '*.pyx' ')' -printf '\n' |
+ head -n 2 | wc -l
) ]]; then
esetup.py build_ext -j "${jobs}" "${@}"
fi