Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 5/8] python-r1: calculate final list of enabled impls for foreach.
Date: Wed, 27 Feb 2013 21:45:24
Message-Id: 1362001405-25636-5-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [RFC] multibuild.eclass -- a generic pluggable framework to handle multi-variant builds by "Michał Górny"
1 ---
2 gx86/eclass/python-r1.eclass | 61 +++++++++++++++++++++++++++-----------------
3 1 file changed, 37 insertions(+), 24 deletions(-)
4
5 diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
6 index 310859e..a1d9228 100644
7 --- a/gx86/eclass/python-r1.eclass
8 +++ b/gx86/eclass/python-r1.eclass
9 @@ -586,6 +586,22 @@ _python_check_USE_PYTHON() {
10 fi
11 }
12
13 +# @FUNCTION: _python_obtain_impls
14 +# @INTERNAL
15 +# @DESCRIPTION:
16 +# Set up the enabled implementation list.
17 +_python_obtain_impls() {
18 + MULTIBUILD_VARIANTS=()
19 +
20 + for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
21 + if has "${impl}" "${PYTHON_COMPAT[@]}" \
22 + && use "python_targets_${impl}"
23 + then
24 + MULTIBUILD_VARIANTS+=( "${impl}" )
25 + fi
26 + done
27 +}
28 +
29 # @FUNCTION: python_foreach_impl
30 # @USAGE: <command> [<args>...]
31 # @DESCRIPTION:
32 @@ -608,33 +624,30 @@ python_foreach_impl() {
33 local impl
34 local bdir=${BUILD_DIR:-${S}}
35 local ret=0 lret=0
36 + local MULTIBUILD_VARIANTS
37
38 debug-print "${FUNCNAME}: bdir = ${bdir}"
39 - for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
40 - if has "${impl}" "${PYTHON_COMPAT[@]}" \
41 - && _python_impl_supported "${impl}" \
42 - && use "python_targets_${impl}"
43 - then
44 - local EPYTHON PYTHON
45 - python_export "${impl}" EPYTHON PYTHON
46 - local BUILD_DIR=${bdir%%/}-${impl}
47 - export EPYTHON PYTHON
48 -
49 - einfo "${EPYTHON}: running ${@}" \
50 - | tee -a "${T}/build-${EPYTHON}.log"
51 -
52 - # _python_parallel() does redirection internally.
53 - # note: this is a hidden API to avoid writing python_foreach_impl
54 - # twice. do *not* even think of using it anywhere else.
55 - if [[ ${1} == _python_parallel ]]; then
56 - "${@}"
57 - else
58 - "${@}" 2>&1 | tee -a "${T}/build-${EPYTHON}.log"
59 - fi
60 - lret=${?}
61 -
62 - [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
63 + _python_obtain_impls
64 + for impl in "${MULTIBUILD_VARIANTS[@]}"; do
65 + local EPYTHON PYTHON
66 + python_export "${impl}" EPYTHON PYTHON
67 + local BUILD_DIR=${bdir%%/}-${impl}
68 + export EPYTHON PYTHON
69 +
70 + einfo "${EPYTHON}: running ${@}" \
71 + | tee -a "${T}/build-${EPYTHON}.log"
72 +
73 + # _python_parallel() does redirection internally.
74 + # note: this is a hidden API to avoid writing python_foreach_impl
75 + # twice. do *not* even think of using it anywhere else.
76 + if [[ ${1} == _python_parallel ]]; then
77 + "${@}"
78 + else
79 + "${@}" 2>&1 | tee -a "${T}/build-${EPYTHON}.log"
80 fi
81 + lret=${?}
82 +
83 + [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
84 done
85
86 return ${ret}
87 --
88 1.8.1.4