Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 29 May 2017 21:54:12
Message-Id: 1496094817.452f2b21a8c0c4e51006440cc7c4e680e8f4bea5.mgorny@gentoo
1 commit: 452f2b21a8c0c4e51006440cc7c4e680e8f4bea5
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 20 09:48:29 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon May 29 21:53:37 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=452f2b21
7
8 distutils-r1.eclass: Reuse python_setup for common phases
9
10 Rewrite the python_*_all() phase running code to reuse python_setup
11 instead of hacking on top of python_foreach_impl. The resulting code
12 is a bit simpler but most importantly, it avoids duplication of code
13 from python-r1 and ensures that distutils-r1 common phases are directly
14 altered by changes in python_setup.
15
16 The code still needs to reimplement some of the internals. However, it
17 is mostly limited to code specific to distutils-r1, and should be more
18 maintainable.
19
20 eclass/distutils-r1.eclass | 26 +++++++++++++-------------
21 1 file changed, 13 insertions(+), 13 deletions(-)
22
23 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
24 index e79f86bab12..167af95eaed 100644
25 --- a/eclass/distutils-r1.eclass
26 +++ b/eclass/distutils-r1.eclass
27 @@ -672,20 +672,20 @@ distutils-r1_run_phase() {
28 _distutils-r1_run_common_phase() {
29 local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR}
30
31 - if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
32 - local best_impl patterns=( "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]-*}" )
33 - _distutils_try_impl() {
34 - if _python_impl_matches "${EPYTHON}" "${patterns[@]}"; then
35 - best_impl=${MULTIBUILD_VARIANT}
36 - fi
37 - }
38 - python_foreach_impl _distutils_try_impl
39 - unset -f _distutils_try_impl
40 -
41 - local PYTHON_COMPAT=( "${best_impl}" )
42 + if [[ ${DISTUTILS_SINGLE_IMPL} ]]; then
43 + # reuse the dedicated code branch
44 + _distutils-r1_run_foreach_impl "${@}"
45 + else
46 + local -x EPYTHON PYTHON
47 + local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
48 + python_setup "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]}"
49 +
50 + local MULTIBUILD_VARIANTS=( "${EPYTHON/./_}" )
51 + # store for restoring after distutils-r1_run_phase.
52 + local _DISTUTILS_INITIAL_CWD=${PWD}
53 + multibuild_foreach_variant \
54 + distutils-r1_run_phase "${@}"
55 fi
56 -
57 - _distutils-r1_run_foreach_impl "${@}"
58 }
59
60 # @FUNCTION: _distutils-r1_run_foreach_impl