Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 09 Feb 2022 09:39:39
Message-Id: 1644396236.f8e51b15e363e1cde95411927c21d620cb646f68.mgorny@gentoo
1 commit: f8e51b15e363e1cde95411927c21d620cb646f68
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 5 09:14:25 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 9 08:43:56 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8e51b15
7
8 python-any-r1.eclass: Do not test EPYTHON twice
9
10 Avoid checking the implementation from EPYTHON via fallback iteration.
11 While there's no technical harm in doing that, now that we output
12 verbosely the users will notice ;-).
13
14 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
15
16 eclass/python-any-r1.eclass | 14 ++++++++------
17 1 file changed, 8 insertions(+), 6 deletions(-)
18
19 diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
20 index 5c01e9eb6888..4e954f57cd2d 100644
21 --- a/eclass/python-any-r1.eclass
22 +++ b/eclass/python-any-r1.eclass
23 @@ -299,13 +299,13 @@ python_setup() {
24 fi
25
26 # first, try ${EPYTHON}... maybe it's good enough for us.
27 - if [[ ${EPYTHON} ]]; then
28 - local impl=${EPYTHON/./_}
29 - if ! has "${impl}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then
30 + local epython_impl=${EPYTHON/./_}
31 + if [[ ${epython_impl} ]]; then
32 + if ! has "${epython_impl}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then
33 einfo "EPYTHON (${EPYTHON}) not supported by the package"
34 - elif ! has "${impl}" "${_PYTHON_ALL_IMPLS[@]}"; then
35 + elif ! has "${epython_impl}" "${_PYTHON_ALL_IMPLS[@]}"; then
36 ewarn "Invalid EPYTHON: ${EPYTHON}"
37 - elif _python_run_check_deps "${impl}"; then
38 + elif _python_run_check_deps "${epython_impl}"; then
39 _python_export EPYTHON PYTHON
40 _python_wrapper_setup
41 einfo "Using ${EPYTHON} to build (via EPYTHON)"
42 @@ -313,10 +313,12 @@ python_setup() {
43 fi
44 fi
45
46 - # fallback to best installed impl.
47 + # fallback to the best installed impl.
48 # (reverse iteration over _PYTHON_SUPPORTED_IMPLS)
49 for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do
50 local impl=${_PYTHON_SUPPORTED_IMPLS[i]}
51 + # avoid checking EPYTHON twice
52 + [[ ${impl} == ${epython_impl} ]] && continue
53 _python_export "${impl}" EPYTHON PYTHON
54 if _python_run_check_deps "${impl}"; then
55 _python_wrapper_setup