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 5/5] python-any-r1.eclass: Use reverse iter instead of reversing impls array
Date: Thu, 17 Dec 2015 22:06:40
Message-Id: 1450389778-10144-6-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 ---
2 eclass/python-any-r1.eclass | 10 +++-------
3 1 file changed, 3 insertions(+), 7 deletions(-)
4
5 diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
6 index 99aac73..c6dfc9c 100644
7 --- a/eclass/python-any-r1.eclass
8 +++ b/eclass/python-any-r1.eclass
9 @@ -313,13 +313,9 @@ python_setup() {
10 done
11
12 # fallback to best installed impl.
13 - local rev_impls=()
14 - for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
15 - rev_impls=( "${i}" "${rev_impls[@]}" )
16 - done
17 -
18 - for i in "${rev_impls[@]}"; do
19 - python_export "${i}" EPYTHON PYTHON
20 + # (reverse iteration over _PYTHON_SUPPORTED_IMPLS)
21 + for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do
22 + python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON
23 if _python_EPYTHON_supported "${EPYTHON}"; then
24 python_wrapper_setup
25 return
26 --
27 2.6.4