From 2e85852793d7d97f7eeb52641609302d73d4aabb Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Fri, 22 Apr 2022 09:31:51 +0200 Subject: distutils-r1.eclass: Run build_ext only if there are 2+ files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- eclass/distutils-r1.eclass | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'eclass/distutils-r1.eclass') 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 -- cgit v1.2.3-65-gdbad