Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 2/5] python-single-r1.eclass: Fix python_gen_* w/ single PYTHON_COMPAT impl
Date: Thu, 17 Dec 2015 22:04:30
Message-Id: 1450389778-10144-3-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/5] python*-r1: commonize PYTHON_COMPAT handling by "Michał Górny"
1 Fix python_gen_useflags() and python_gen_cond_dep() to output correct
2 flag name when only a single implementation is listed in PYTHON_COMPAT.
3 In this case, the PYTHON_SINGLE_TARGET flags are not emitted
4 and PYTHON_TARGETS are used directly instead.
5 ---
6 eclass/python-single-r1.eclass | 20 ++++++++++++++++----
7 1 file changed, 16 insertions(+), 4 deletions(-)
8
9 diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
10 index 8ef3846..4c4f057 100644
11 --- a/eclass/python-single-r1.eclass
12 +++ b/eclass/python-single-r1.eclass
13 @@ -310,13 +310,19 @@ python_gen_usedep() {
14 python_gen_useflags() {
15 debug-print-function ${FUNCNAME} "${@}"
16
17 - local impl pattern
18 + local flag_prefix impl pattern
19 local matches=()
20
21 + if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
22 + flag_prefix=python_targets
23 + else
24 + flag_prefix=python_single_target
25 + fi
26 +
27 for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
28 for pattern; do
29 if [[ ${impl} == ${pattern} ]]; then
30 - matches+=( "python_single_target_${impl}" )
31 + matches+=( "${flag_prefix}_${impl}" )
32 break
33 fi
34 done
35 @@ -354,9 +360,15 @@ python_gen_useflags() {
36 python_gen_cond_dep() {
37 debug-print-function ${FUNCNAME} "${@}"
38
39 - local impl pattern
40 + local flag_prefix impl pattern
41 local matches=()
42
43 + if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
44 + flag_prefix=python_targets
45 + else
46 + flag_prefix=python_single_target
47 + fi
48 +
49 local dep=${1}
50 shift
51
52 @@ -371,7 +383,7 @@ python_gen_cond_dep() {
53 dep=${dep//\$\{PYTHON_USEDEP\}/${usedep}}
54 fi
55
56 - matches+=( "python_single_target_${impl}? ( ${dep} )" )
57 + matches+=( "${flag_prefix}_${impl}? ( ${dep} )" )
58 break
59 fi
60 done
61 --
62 2.6.4