commit:     86d403b7707e15059afa36db4576b4771012c86b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 31 11:39:47 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jan 31 00:06:33 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86d403b7

python-utils-r1.eclass: Disable py2.7, except for p-any-r1

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

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

diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index 5f2dc5b8f38..313fe6b40df 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-r1.eclass
@@ -174,6 +174,7 @@ _python_any_set_globals() {
        local usestr deps i PYTHON_PKG_DEP
        [[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
 
+       _PYTHON_ALLOW_PY27=1 \
        _python_set_impls
 
        for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 6d482aa106c..dcc441b8209 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -40,7 +40,6 @@ inherit toolchain-funcs
 # All supported Python implementations, most preferred last.
 _PYTHON_ALL_IMPLS=(
        pypy3
-       python2_7
        python3_7 python3_8 python3_9
 )
 readonly _PYTHON_ALL_IMPLS
@@ -52,7 +51,7 @@ readonly _PYTHON_ALL_IMPLS
 _PYTHON_HISTORICAL_IMPLS=(
        jython2_7
        pypy pypy1_{8,9} pypy2_0
-       python2_{5,6}
+       python2_{5..7}
        python3_{1..6}
 )
 readonly _PYTHON_HISTORICAL_IMPLS
@@ -149,7 +148,13 @@ _python_set_impls() {
        done
 
        if [[ ! ${supp[@]} ]]; then
-               die "No supported implementation in PYTHON_COMPAT."
+               # special-case python2_7 for python-any-r1
+               if [[ ${_PYTHON_ALLOW_PY27} ]] && has python2_7 
"${PYTHON_COMPAT[@]}"
+               then
+                       supp+=( python2_7 )
+               else
+                       die "No supported implementation in PYTHON_COMPAT."
+               fi
        fi
 
        if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then

Reply via email to