mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-24 06:48:18 -07:00
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.
This commit is contained in:
@@ -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
|
||||
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 PYTHON_COMPAT=( "${best_impl}" )
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user