summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-05-20 11:48:29 +0200
committerMichał Górny <mgorny@gentoo.org>2017-05-29 23:53:37 +0200
commit452f2b21a8c0c4e51006440cc7c4e680e8f4bea5 (patch)
treea4240776c13a60a3e5940417d2bf184e79d93db6 /eclass
parentdistutils-r1.eclass: Remove QA-warning for DISTUTILS_NO_PARALLEL_BUILD (diff)
downloadgentoo-452f2b21a8c0c4e51006440cc7c4e680e8f4bea5.tar.gz
gentoo-452f2b21a8c0c4e51006440cc7c4e680e8f4bea5.tar.bz2
gentoo-452f2b21a8c0c4e51006440cc7c4e680e8f4bea5.zip
distutils-r1.eclass: Reuse python_setup for common phases
Rewrite the python_*_all() phase running code to reuse python_setup instead of hacking on top of python_foreach_impl. The resulting code is a bit simpler but most importantly, it avoids duplication of code from python-r1 and ensures that distutils-r1 common phases are directly altered by changes in python_setup. The code still needs to reimplement some of the internals. However, it is mostly limited to code specific to distutils-r1, and should be more maintainable.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/distutils-r1.eclass26
1 files changed, 13 insertions, 13 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index e79f86bab12d..167af95eaed6 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -672,20 +672,20 @@ distutils-r1_run_phase() {
_distutils-r1_run_common_phase() {
local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR}
- if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
- local best_impl patterns=( "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]-*}" )
- _distutils_try_impl() {
- if _python_impl_matches "${EPYTHON}" "${patterns[@]}"; then
- best_impl=${MULTIBUILD_VARIANT}
- fi
- }
- python_foreach_impl _distutils_try_impl
- unset -f _distutils_try_impl
-
- local PYTHON_COMPAT=( "${best_impl}" )
+ if [[ ${DISTUTILS_SINGLE_IMPL} ]]; then
+ # reuse the dedicated code branch
+ _distutils-r1_run_foreach_impl "${@}"
+ else
+ local -x EPYTHON PYTHON
+ local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
+ python_setup "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]}"
+
+ local MULTIBUILD_VARIANTS=( "${EPYTHON/./_}" )
+ # store for restoring after distutils-r1_run_phase.
+ local _DISTUTILS_INITIAL_CWD=${PWD}
+ multibuild_foreach_variant \
+ distutils-r1_run_phase "${@}"
fi
-
- _distutils-r1_run_foreach_impl "${@}"
}
# @FUNCTION: _distutils-r1_run_foreach_impl