commit: abbb9b973fe89bcf28bf2920c45aba96c7083365 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Wed Apr 19 11:14:31 2023 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sat Apr 22 06:17:03 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abbb9b97
distutils-r1.eclass: Issue build_ext only w/ DISTUTILS_EXT Issue the explicit `build_ext` command call only if `DISTUTILS_EXT` is set. This should avoid a few false positives where the command was called due to irrelevant .c files being present in the source tree. Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> eclass/distutils-r1.eclass | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index b089f2e007b1..28a1f449e217 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -62,6 +62,9 @@ esac # DISTUTILS_OPTIONAL is used # # - adds `debug` flag to IUSE that controls assertions (i.e. -DNDEBUG) +# +# - calls `build_ext` command if setuptools build backend is used +# and there is potential benefit from parallel builds # @ECLASS_VARIABLE: DISTUTILS_OPTIONAL # @DEFAULT_UNSET @@ -1452,12 +1455,14 @@ distutils-r1_python_compile() { # .pyx is added for Cython # # esetup.py does not respect SYSROOT, so skip it there - if [[ -z ${SYSROOT} && 1 -ne ${jobs} && 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' ')' -printf '\n' | - head -n 2 | wc -l - ) ]]; then + if [[ -z ${SYSROOT} && ${DISTUTILS_EXT} && 1 -ne ${jobs} + && 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' ')' -printf '\n' | + head -n 2 | wc -l + ) + ]]; then esetup.py build_ext -j "${jobs}" "${@}" fi else