eclass/python-utils-r1: Sync with Gentoo

It's from Gentoo commit d133f3d0eb162f6d6e1385f9c96f9814315cd9c9.
This commit is contained in:
Flatcar Buildbot 2025-05-05 07:09:56 +00:00 committed by Krzesimir Nowak
parent edf429ef2e
commit 6cf3fd1fce

View File

@ -39,9 +39,9 @@ inherit multiprocessing toolchain-funcs
# @DESCRIPTION: # @DESCRIPTION:
# All supported Python implementations, most preferred last. # All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=( _PYTHON_ALL_IMPLS=(
pypy3 pypy3_11 pypy3_11
python3_13t python3_13t
python3_{10..13} python3_{11..13}
) )
readonly _PYTHON_ALL_IMPLS readonly _PYTHON_ALL_IMPLS
@ -51,9 +51,9 @@ readonly _PYTHON_ALL_IMPLS
# All historical Python implementations that are no longer supported. # All historical Python implementations that are no longer supported.
_PYTHON_HISTORICAL_IMPLS=( _PYTHON_HISTORICAL_IMPLS=(
jython2_7 jython2_7
pypy pypy1_{8,9} pypy2_0 pypy pypy1_{8,9} pypy2_0 pypy3
python2_{5..7} python2_{5..7}
python3_{1..9} python3_{1..10}
) )
readonly _PYTHON_HISTORICAL_IMPLS readonly _PYTHON_HISTORICAL_IMPLS
@ -137,9 +137,9 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS # please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS # and _PYTHON_HISTORICAL_IMPLS
case ${i} in case ${i} in
pypy3|pypy3_11|python3_9|python3_1[0-3]|python3_13t) pypy3_11|python3_9|python3_1[1-3]|python3_13t)
;; ;;
jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9]) jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]|python3_10)
obsolete+=( "${i}" ) obsolete+=( "${i}" )
;; ;;
*) *)
@ -208,6 +208,8 @@ _python_impl_matches() {
local impl=${1/./_} pattern local impl=${1/./_} pattern
shift shift
# note: do not add "return 1" below, the function is supposed
# to iterate until it matches something
for pattern; do for pattern; do
case ${pattern} in case ${pattern} in
-2|python2*|pypy) -2|python2*|pypy)
@ -229,8 +231,6 @@ _python_impl_matches() {
return 0 return 0
;; ;;
3.10) 3.10)
[[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
return 0
;; ;;
3.8|3.9|3.1[1-3]) 3.8|3.9|3.1[1-3])
[[ ${impl%t} == python${pattern/./_} || ${impl} == pypy${pattern/./_} ]] && [[ ${impl%t} == python${pattern/./_} || ${impl} == pypy${pattern/./_} ]] &&
@ -449,9 +449,6 @@ _python_export() {
python*) python*)
PYTHON_PKG_DEP="dev-lang/python:${impl#python}${PYTHON_REQ_USE:+[${PYTHON_REQ_USE}]}" PYTHON_PKG_DEP="dev-lang/python:${impl#python}${PYTHON_REQ_USE:+[${PYTHON_REQ_USE}]}"
;; ;;
pypy3)
PYTHON_PKG_DEP="dev-lang/pypy:3.10=[symlink${PYTHON_REQ_USE:+,${PYTHON_REQ_USE}}]"
;;
pypy3.*) pypy3.*)
PYTHON_PKG_DEP="dev-lang/pypy:${impl#pypy}=${PYTHON_REQ_USE:+[${PYTHON_REQ_USE}]}" PYTHON_PKG_DEP="dev-lang/pypy:${impl#pypy}=${PYTHON_REQ_USE:+[${PYTHON_REQ_USE}]}"
;; ;;