1 |
Python 3.5+ introduces parallel build support in distutils. Take |
2 |
advantage of that by passing appropriate -j option. Since distutils |
3 |
does not support an equivalent of --load-average, default to the number |
4 |
of CPUs+1 when unspecified. |
5 |
--- |
6 |
eclass/distutils-r1.eclass | 17 ++++++++++++++--- |
7 |
1 file changed, 14 insertions(+), 3 deletions(-) |
8 |
|
9 |
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass |
10 |
index 975383acc09b..4d8aa3ca6677 100644 |
11 |
--- a/eclass/distutils-r1.eclass |
12 |
+++ b/eclass/distutils-r1.eclass |
13 |
@@ -80,10 +80,10 @@ if [[ ! ${_DISTUTILS_R1} ]]; then |
14 |
|
15 |
[[ ${EAPI} == [45] ]] && inherit eutils |
16 |
[[ ${EAPI} == [56] ]] && inherit xdg-utils |
17 |
-inherit toolchain-funcs |
18 |
+inherit multiprocessing toolchain-funcs |
19 |
|
20 |
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then |
21 |
- inherit multiprocessing python-r1 |
22 |
+ inherit python-r1 |
23 |
else |
24 |
inherit python-single-r1 |
25 |
fi |
26 |
@@ -454,7 +454,18 @@ distutils-r1_python_compile() { |
27 |
|
28 |
_distutils-r1_copy_egg_info |
29 |
|
30 |
- esetup.py build "${@}" |
31 |
+ local build_args=() |
32 |
+ # distutils is parallel-capable since py3.5 |
33 |
+ if python_is_python3 && [[ ${EPYTHON} != python3.4 ]]; then |
34 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" INF) |
35 |
+ if [[ ${jobs} == INF ]]; then |
36 |
+ local nproc=$(get_nproc) |
37 |
+ jobs=$(( nproc + 1 )) |
38 |
+ fi |
39 |
+ build_args+=( -j "${jobs}" ) |
40 |
+ fi |
41 |
+ |
42 |
+ esetup.py build "${build_args[@]}" "${@}" |
43 |
} |
44 |
|
45 |
# @FUNCTION: _distutils-r1_wrap_scripts |
46 |
-- |
47 |
2.18.0 |