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 09/10] python-single-r1.eclass: Refactor global setter to use locals, NFC
Date: Wed, 01 Mar 2017 16:10:52
Message-Id: 20170301160249.11287-10-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] python-r1, add integrity checks for redefined control vars by "Michał Górny"
1 ---
2 eclass/python-single-r1.eclass | 20 ++++++++++++--------
3 1 file changed, 12 insertions(+), 8 deletions(-)
4
5 diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
6 index 84d1f067be14..85350924b657 100644
7 --- a/eclass/python-single-r1.eclass
8 +++ b/eclass/python-single-r1.eclass
9 @@ -180,7 +180,6 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
10 _python_single_set_globals() {
11 _python_set_impls
12
13 - PYTHON_DEPS=
14 local i PYTHON_PKG_DEP
15
16 local flags_mt=( "${_PYTHON_SUPPORTED_IMPLS[@]/#/python_targets_}" )
17 @@ -191,12 +190,13 @@ _python_single_set_globals() {
18
19 IUSE="${flags_mt[*]}"
20
21 + local deps requse usedep
22 if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
23 # There is only one supported implementation; set IUSE and other
24 # variables without PYTHON_SINGLE_TARGET.
25 - PYTHON_REQUIRED_USE="${flags_mt[*]}"
26 + requse=${flags_mt[*]}
27 python_export "${_PYTHON_SUPPORTED_IMPLS[0]}" PYTHON_PKG_DEP
28 - PYTHON_DEPS="${flags_mt[*]}? ( ${PYTHON_PKG_DEP} ) "
29 + deps="${flags_mt[*]}? ( ${PYTHON_PKG_DEP} ) "
30 # Force on the python_single_target_* flag for this impl, so
31 # that any dependencies that inherit python-single-r1 and
32 # happen to have multiple implementations will still need
33 @@ -205,7 +205,7 @@ _python_single_set_globals() {
34 else
35 # Multiple supported implementations; honor PYTHON_SINGLE_TARGET.
36 IUSE+=" ${flags[*]}"
37 - PYTHON_REQUIRED_USE="^^ ( ${flags[*]} )"
38 + requse="^^ ( ${flags[*]} )"
39 # Ensure deps honor the same python_single_target_* flag as is set
40 # on this package.
41 optflags+=,${flags[@]/%/(+)?}
42 @@ -214,13 +214,13 @@ _python_single_set_globals() {
43 # The chosen targets need to be in PYTHON_TARGETS as well.
44 # This is in order to enforce correct dependencies on packages
45 # supporting multiple implementations.
46 - PYTHON_REQUIRED_USE+=" python_single_target_${i}? ( python_targets_${i} )"
47 + requse+=" python_single_target_${i}? ( python_targets_${i} )"
48
49 python_export "${i}" PYTHON_PKG_DEP
50 - PYTHON_DEPS+="python_single_target_${i}? ( ${PYTHON_PKG_DEP} ) "
51 + deps+="python_single_target_${i}? ( ${PYTHON_PKG_DEP} ) "
52 done
53 fi
54 - PYTHON_USEDEP=${optflags// /,}
55 + usedep=${optflags// /,}
56
57 # 1) well, python-exec would suffice as an RDEP
58 # but no point in making this overcomplex, BDEP doesn't hurt anyone
59 @@ -229,8 +229,12 @@ _python_single_set_globals() {
60 if [[ ${_PYTHON_WANT_PYTHON_EXEC2} == 0 ]]; then
61 die "python-exec:0 is no longer supported, please fix your ebuild to work with python-exec:2"
62 else
63 - PYTHON_DEPS+=">=dev-lang/python-exec-2:=[${PYTHON_USEDEP}]"
64 + deps+=">=dev-lang/python-exec-2:=[${usedep}]"
65 fi
66 +
67 + PYTHON_DEPS=${deps}
68 + PYTHON_REQUIRED_USE=${requse}
69 + PYTHON_USEDEP=${usedep}
70 readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP
71 }
72 _python_single_set_globals
73 --
74 2.12.0