summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-04-19 13:14:31 +0200
committerMichał Górny <mgorny@gentoo.org>2023-04-22 08:17:03 +0200
commitabbb9b973fe89bcf28bf2920c45aba96c7083365 (patch)
treef8dc57a87606599ff4f372129abadcd944d02f60 /eclass/distutils-r1.eclass
parentdistutils-r1.eclass: Support IUSE=debug for DISTUTILS_EXT (diff)
downloadgentoo-abbb9b973fe89bcf28bf2920c45aba96c7083365.tar.gz
gentoo-abbb9b973fe89bcf28bf2920c45aba96c7083365.tar.bz2
gentoo-abbb9b973fe89bcf28bf2920c45aba96c7083365.zip
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@gentoo.org>
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass17
1 files 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