1 |
Rewrite the python_*_all() phase running code to reuse python_setup |
2 |
instead of hacking on top of python_foreach_impl. The resulting code |
3 |
is a bit simpler but most importantly, it avoids duplication of code |
4 |
from python-r1 and ensures that distutils-r1 common phases are directly |
5 |
altered by changes in python_setup. |
6 |
|
7 |
The code still needs to reimplement some of the internals. However, it |
8 |
is mostly limited to code specific to distutils-r1, and should be more |
9 |
maintainable. |
10 |
--- |
11 |
eclass/distutils-r1.eclass | 26 +++++++++++++------------- |
12 |
1 file changed, 13 insertions(+), 13 deletions(-) |
13 |
|
14 |
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass |
15 |
index e79f86bab12d..167af95eaed6 100644 |
16 |
--- a/eclass/distutils-r1.eclass |
17 |
+++ b/eclass/distutils-r1.eclass |
18 |
@@ -672,20 +672,20 @@ distutils-r1_run_phase() { |
19 |
_distutils-r1_run_common_phase() { |
20 |
local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR} |
21 |
|
22 |
- if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then |
23 |
- local best_impl patterns=( "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]-*}" ) |
24 |
- _distutils_try_impl() { |
25 |
- if _python_impl_matches "${EPYTHON}" "${patterns[@]}"; then |
26 |
- best_impl=${MULTIBUILD_VARIANT} |
27 |
- fi |
28 |
- } |
29 |
- python_foreach_impl _distutils_try_impl |
30 |
- unset -f _distutils_try_impl |
31 |
- |
32 |
- local PYTHON_COMPAT=( "${best_impl}" ) |
33 |
+ if [[ ${DISTUTILS_SINGLE_IMPL} ]]; then |
34 |
+ # reuse the dedicated code branch |
35 |
+ _distutils-r1_run_foreach_impl "${@}" |
36 |
+ else |
37 |
+ local -x EPYTHON PYTHON |
38 |
+ local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH} |
39 |
+ python_setup "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]}" |
40 |
+ |
41 |
+ local MULTIBUILD_VARIANTS=( "${EPYTHON/./_}" ) |
42 |
+ # store for restoring after distutils-r1_run_phase. |
43 |
+ local _DISTUTILS_INITIAL_CWD=${PWD} |
44 |
+ multibuild_foreach_variant \ |
45 |
+ distutils-r1_run_phase "${@}" |
46 |
fi |
47 |
- |
48 |
- _distutils-r1_run_foreach_impl "${@}" |
49 |
} |
50 |
|
51 |
# @FUNCTION: _distutils-r1_run_foreach_impl |
52 |
-- |
53 |
2.13.0 |