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 03/10] python-any-r1.eclass: Global setter, refactor for more local vars
Date: Wed, 01 Mar 2017 16:05:10
Message-Id: 20170301160249.11287-4-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] python-r1, add integrity checks for redefined control vars by "Michał Górny"
1 Refactor _python_any_set_globals() to use local variables while
2 generating all output, and copy it to final vars at the end. This is
3 in preparation for integrity checks. NFC.
4 ---
5 eclass/python-any-r1.eclass | 11 ++++++-----
6 1 file changed, 6 insertions(+), 5 deletions(-)
7
8 diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
9 index a1dd4282c1ef..d41cf6a5808d 100644
10 --- a/eclass/python-any-r1.eclass
11 +++ b/eclass/python-any-r1.eclass
12 @@ -1,4 +1,4 @@
13 -# Copyright 1999-2015 Gentoo Foundation
14 +# Copyright 1999-2017 Gentoo Foundation
15 # Distributed under the terms of the GNU General Public License v2
16
17 # @ECLASS: python-any-r1.eclass
18 @@ -148,19 +148,20 @@ if [[ ! ${_PYTHON_ANY_R1} ]]; then
19 # @CODE
20
21 _python_any_set_globals() {
22 - local usestr i PYTHON_PKG_DEP
23 + local usestr deps i PYTHON_PKG_DEP
24 [[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
25
26 _python_set_impls
27
28 - PYTHON_DEPS=
29 for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
30 python_export "${i}" PYTHON_PKG_DEP
31
32 # note: need to strip '=' slot operator for || deps
33 - PYTHON_DEPS="${PYTHON_PKG_DEP%=} ${PYTHON_DEPS}"
34 + deps="${PYTHON_PKG_DEP%=} ${deps}"
35 done
36 - PYTHON_DEPS="|| ( ${PYTHON_DEPS})"
37 + deps="|| ( ${deps})"
38 +
39 + PYTHON_DEPS=${deps}
40 readonly PYTHON_DEPS
41 }
42 _python_any_set_globals
43 --
44 2.12.0