* [gentoo-dev] [PATCH] distutils-r1.eclass: Enable parallel builds in py3.5+
@ 2018-07-17 8:41 99% Michał Górny
0 siblings, 0 replies; 1+ results
From: Michał Górny @ 2018-07-17 8:41 UTC (permalink / raw
To: gentoo-dev; +Cc: python, Michał Górny
Python 3.5+ introduces parallel build support in distutils. Take
advantage of that by passing appropriate -j option. Since distutils
does not support an equivalent of --load-average, default to the number
of CPUs+1 when unspecified.
---
eclass/distutils-r1.eclass | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 975383acc09b..4d8aa3ca6677 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -80,10 +80,10 @@ if [[ ! ${_DISTUTILS_R1} ]]; then
[[ ${EAPI} == [45] ]] && inherit eutils
[[ ${EAPI} == [56] ]] && inherit xdg-utils
-inherit toolchain-funcs
+inherit multiprocessing toolchain-funcs
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
- inherit multiprocessing python-r1
+ inherit python-r1
else
inherit python-single-r1
fi
@@ -454,7 +454,18 @@ distutils-r1_python_compile() {
_distutils-r1_copy_egg_info
- esetup.py build "${@}"
+ local build_args=()
+ # distutils is parallel-capable since py3.5
+ if python_is_python3 && [[ ${EPYTHON} != python3.4 ]]; then
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" INF)
+ if [[ ${jobs} == INF ]]; then
+ local nproc=$(get_nproc)
+ jobs=$(( nproc + 1 ))
+ fi
+ build_args+=( -j "${jobs}" )
+ fi
+
+ esetup.py build "${build_args[@]}" "${@}"
}
# @FUNCTION: _distutils-r1_wrap_scripts
--
2.18.0
^ permalink raw reply related [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2018-07-17 8:41 99% [gentoo-dev] [PATCH] distutils-r1.eclass: Enable parallel builds in py3.5+ Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox