commit: 2e85852793d7d97f7eeb52641609302d73d4aabb
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 22 07:31:51 2022 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 12:08:46 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e858527
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 <AT> gentoo.org>
eclass/distutils-r1.eclass | 12 ++++++++----
1 file 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