commit:     d133f3d0eb162f6d6e1385f9c96f9814315cd9c9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri May  2 04:10:01 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri May  2 04:10:01 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d133f3d0

python-utils-r1.eclass: Fix matching pattern list starting with 3.10

Closes: https://bugs.gentoo.org/955213
Fixes: 92cf8fae5081 (Disable Python 3.10 / PyPy 3.10 targets)
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-utils-r1.eclass   | 3 ++-
 eclass/tests/python-utils-r1.sh | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 860250cbe1eb..ef05a58e1b13 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -208,6 +208,8 @@ _python_impl_matches() {
        local impl=${1/./_} pattern
        shift
 
+       # note: do not add "return 1" below, the function is supposed
+       # to iterate until it matches something
        for pattern; do
                case ${pattern} in
                        -2|python2*|pypy)
@@ -229,7 +231,6 @@ _python_impl_matches() {
                                return 0
                                ;;
                        3.10)
-                               return 1
                                ;;
                        3.8|3.9|3.1[1-3])
                                [[ ${impl%t} == python${pattern/./_} || ${impl} 
== pypy${pattern/./_} ]] &&

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index eb5201bf413c..09de934e703d 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -212,6 +212,15 @@ test_is "_python_impl_matches python3_12 3.12" 0
 test_is "_python_impl_matches pypy3_11 3.10" 1
 test_is "_python_impl_matches pypy3_11 3.11" 0
 test_is "_python_impl_matches pypy3_11 3.12" 1
+# https://bugs.gentoo.org/95521
+test_is "_python_impl_matches python3_11 3.10 3.11" 0
+test_is "_python_impl_matches python3_11 3.11 3.12" 0
+test_is "_python_impl_matches python3_11 3.10 3.12" 1
+test_is "_python_impl_matches python3_11 3.10 3.11 3.12" 0
+test_is "_python_impl_matches python3_12 3.10 3.11" 1
+test_is "_python_impl_matches python3_12 3.11 3.12" 0
+test_is "_python_impl_matches python3_12 3.10 3.12" 0
+test_is "_python_impl_matches python3_12 3.10 3.11 3.12" 0
 eoutdent
 
 rm "${tmpfile}"

Reply via email to