summaryrefslogtreecommitdiff
path: root/eclass/python-utils-r1.eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass16
1 files changed, 11 insertions, 5 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index b104b6694ac3..a2b5b6d5d41a 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -35,7 +35,7 @@ fi
if [[ ! ${_PYTHON_UTILS_R1} ]]; then
[[ ${EAPI} == [67] ]] && inherit eapi8-dosym
-inherit toolchain-funcs
+inherit multiprocessing toolchain-funcs
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
# @INTERNAL
@@ -590,6 +590,9 @@ python_optimize() {
debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
fi
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" INF)
+ [[ ${jobs} == INF ]] && jobs=$(get_nproc)
+
local d
for d; do
# make sure to get a nice path without //
@@ -601,11 +604,14 @@ python_optimize() {
"${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
"${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
;;
- python*|pypy3)
+ python3.[5678]|pypy3)
# both levels of optimization are separate since 3.5
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -O -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
+ "${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
+ "${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
+ "${PYTHON}" -OO -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
+ ;;
+ python*)
+ "${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}"
;;
*)
"${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"