Signed-off-by: Michał Górny <[email protected]>
---
eclass/python-utils-r1.eclass | 24 ++++++++++++------------
eclass/tests/python-utils-r1.sh | 19 +++++++++++++++++--
2 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 0cb132b72e3a..affb8e55a50d 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: python-utils-r1.eclass
@@ -39,7 +39,7 @@ inherit multiprocessing toolchain-funcs
# @DESCRIPTION:
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
- pypy3
+ pypy3 pypy3_11
python3_13t
python3_{10..13}
)
@@ -137,7 +137,7 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS
case ${i} in
- pypy3|python3_9|python3_1[0-3]|python3_13t)
+
pypy3|pypy3_11|python3_9|python3_1[0-3]|python3_13t)
;;
jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9])
obsolete+=( "${i}" )
@@ -233,7 +233,8 @@ _python_impl_matches() {
return 0
;;
3.8|3.9|3.1[1-3])
- [[ ${impl%t} == python${pattern/./_} ]] &&
return 0
+ [[ ${impl%t} == python${pattern/./_} || ${impl}
== pypy${pattern/./_} ]] &&
+ return 0
;;
*)
# unify value style to allow lax matching
@@ -304,14 +305,10 @@ _python_export() {
local impl var
case "${1}" in
- python*|jython*)
+ python*|jython*|pypy|pypy3*)
impl=${1/_/.}
shift
;;
- pypy|pypy3)
- impl=${1}
- shift
- ;;
*)
impl=${EPYTHON}
if [[ -z ${impl} ]]; then
@@ -453,7 +450,10 @@ _python_export() {
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}}]"
+
PYTHON_PKG_DEP="dev-lang/pypy:3.10=[symlink${PYTHON_REQ_USE:+,${PYTHON_REQ_USE}}]"
+ ;;
+ pypy3.*)
+
PYTHON_PKG_DEP="dev-lang/pypy:${impl#pypy}=${PYTHON_REQ_USE:+[${PYTHON_REQ_USE}]}"
;;
*)
die "Invalid implementation:
${impl}"
@@ -641,7 +641,7 @@ python_optimize() {
"${PYTHON}" -O -m compileall -j "${jobs}" -q -f
-d "${instpath}" "${d}"
"${PYTHON}" -OO -m compileall -j "${jobs}" -q
-f -d "${instpath}" "${d}"
;;
- python*|pypy3)
+ python*|pypy3*)
# Python 3.9+
"${PYTHON}" -m compileall -j "${jobs}" -o 0 -o
1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}"
;;
@@ -1080,7 +1080,7 @@ python_fix_shebang() {
python|python3)
match=1
;;
-
python2|python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9])
+
python2|python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|pypy3.[1-9][0-9]|jython[23].[0-9])
# Explicit mismatch.
match=1
error=1
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index 81c3c6f78158..b1af3636e519 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -127,11 +127,26 @@ if [[ -x /usr/bin/pypy3 ]]; then
test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3.*/site-packages"
test_var PYTHON_INCLUDEDIR pypy3 "/usr/include/pypy3.*"
fi
-test_var PYTHON_PKG_DEP pypy3 '*dev-lang/pypy*:=\[symlink\]'
-PYTHON_REQ_USE=sqlite test_var PYTHON_PKG_DEP pypy3
'*dev-lang/pypy*:=\[symlink,sqlite\]'
+test_var PYTHON_PKG_DEP pypy3 '*dev-lang/pypy*:3.10=\[symlink\]'
+PYTHON_REQ_USE=sqlite test_var PYTHON_PKG_DEP pypy3
'*dev-lang/pypy*:3.10=\[symlink,sqlite\]'
test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3
eoutdent
+for minor in 11; do
+ ebegin "Testing pypy3.${minor}"
+ eindent
+ test_var EPYTHON "pypy3.${minor}" "pypy3.${minor}"
+ test_var PYTHON "pypy3.${minor}" "/usr/bin/pypy3.${minor}"
+ if [[ -x /usr/bin/pypy3.${minor} ]]; then
+ test_var PYTHON_SITEDIR "pypy3.${minor}"
"/usr/lib*/pypy3.${minor}/site-packages"
+ test_var PYTHON_INCLUDEDIR "pypy3.${minor}"
"/usr/include/pypy3.${minor}"
+ fi
+ test_var PYTHON_PKG_DEP "pypy3.${minor}" '*dev-lang/pypy*:3.11='
+ PYTHON_REQ_USE=sqlite test_var PYTHON_PKG_DEP "pypy3.${minor}"
'*dev-lang/pypy*:3.11=\[sqlite\]'
+ test_var PYTHON_SCRIPTDIR "pypy3.${minor}"
"/usr/lib/python-exec/pypy3.${minor}"
+ eoutdent
+done
+
for EPREFIX in '' /foo; do
einfo "Testing python_fix_shebang with EPREFIX=${EPREFIX@Q}"
eindent