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 01/10] python-utils-r1.eclass: _python_set_impls, use local vars
Date: Wed, 01 Mar 2017 16:07:08
Message-Id: 20170301160249.11287-2-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_set_impls to use local variables throughout
2 the function and assign global values at the end. This prepares it for
3 double-inherit integrity checks. NFC.
4 ---
5 eclass/python-utils-r1.eclass | 11 ++++++-----
6 1 file changed, 6 insertions(+), 5 deletions(-)
7
8 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
9 index 3937d066a095..fd219d95a760 100644
10 --- a/eclass/python-utils-r1.eclass
11 +++ b/eclass/python-utils-r1.eclass
12 @@ -114,21 +114,22 @@ _python_set_impls() {
13 _python_impl_supported "${i}"
14 done
15
16 - _PYTHON_SUPPORTED_IMPLS=()
17 - _PYTHON_UNSUPPORTED_IMPLS=()
18 + local supp=() unsupp=()
19
20 for i in "${_PYTHON_ALL_IMPLS[@]}"; do
21 if has "${i}" "${PYTHON_COMPAT[@]}"; then
22 - _PYTHON_SUPPORTED_IMPLS+=( "${i}" )
23 + supp+=( "${i}" )
24 else
25 - _PYTHON_UNSUPPORTED_IMPLS+=( "${i}" )
26 + unsupp+=( "${i}" )
27 fi
28 done
29
30 - if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 0 ]]; then
31 + if [[ ! ${supp[@]} ]]; then
32 die "No supported implementation in PYTHON_COMPAT."
33 fi
34
35 + _PYTHON_SUPPORTED_IMPLS=( "${supp[@]}" )
36 + _PYTHON_UNSUPPORTED_IMPLS=( "${unsupp[@]}" )
37 readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS
38 }
39
40 --
41 2.12.0