* [gentoo-dev] [PATCH v2] distutils-r1.eclass: Enable parallel builds in py3.5+
@ 2018-07-19 15:01 Michał Górny
2018-07-20 19:51 ` Mike Gilbert
0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2018-07-19 15:01 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.
In order to avoid breaking stable systems, introduce the new behavior
only for EAPI 7 ebuilds, or older EAPI ebuilds with unstable
implementations (Python 3.7 and PyPy 3).
---
eclass/distutils-r1.eclass | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 975383acc09b..85f8f4cb3be9 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,23 @@ distutils-r1_python_compile() {
_distutils-r1_copy_egg_info
- esetup.py build "${@}"
+ local build_args=()
+ # distutils is parallel-capable since py3.5
+ # to avoid breaking stable ebuilds, enable it only if either:
+ # a. we're dealing with EAPI 7
+ # b. we're dealing with Python 3.7 or PyPy3
+ if python_is_python3 && [[ ${EPYTHON} != python3.4 ]]; then
+ if [[ ${EAPI} != [56] || ${EPYTHON} != python3.[56] ]]; then
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" INF)
+ if [[ ${jobs} == INF ]]; then
+ local nproc=$(get_nproc)
+ jobs=$(( nproc + 1 ))
+ fi
+ build_args+=( -j "${jobs}" )
+ fi
+ fi
+
+ esetup.py build "${build_args[@]}" "${@}"
}
# @FUNCTION: _distutils-r1_wrap_scripts
--
2.18.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [gentoo-dev] [PATCH v2] distutils-r1.eclass: Enable parallel builds in py3.5+
2018-07-19 15:01 [gentoo-dev] [PATCH v2] distutils-r1.eclass: Enable parallel builds in py3.5+ Michał Górny
@ 2018-07-20 19:51 ` Mike Gilbert
0 siblings, 0 replies; 2+ messages in thread
From: Mike Gilbert @ 2018-07-20 19:51 UTC (permalink / raw
To: Gentoo Dev; +Cc: Gentoo Python Project, Michał Górny
On Thu, Jul 19, 2018 at 11:01 AM, Michał Górny <mgorny@gentoo.org> wrote:
> 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.
>
> In order to avoid breaking stable systems, introduce the new behavior
> only for EAPI 7 ebuilds, or older EAPI ebuilds with unstable
> implementations (Python 3.7 and PyPy 3).
Looks good to me.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-20 19:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-19 15:01 [gentoo-dev] [PATCH v2] distutils-r1.eclass: Enable parallel builds in py3.5+ Michał Górny
2018-07-20 19:51 ` Mike Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox