Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/6] python-utils-r1.eclass: Add support for python3.11
Date: Sun, 08 May 2022 18:27:17
Message-Id: 20220508182642.4112-2-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/6] python-utils-r1.eclass: Python 3.11 support by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/python-utils-r1.eclass | 10 ++++++----
4 eclass/tests/python-utils-r1.sh | 14 ++++++++++++++
5 2 files changed, 20 insertions(+), 4 deletions(-)
6
7 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
8 index 7b1bd012a37e..2b22b0539ecb 100644
9 --- a/eclass/python-utils-r1.eclass
10 +++ b/eclass/python-utils-r1.eclass
11 @@ -43,7 +43,7 @@ inherit multiprocessing toolchain-funcs
12 # All supported Python implementations, most preferred last.
13 _PYTHON_ALL_IMPLS=(
14 pypy3
15 - python3_{8..10}
16 + python3_{8..11}
17 )
18 readonly _PYTHON_ALL_IMPLS
19
20 @@ -83,7 +83,7 @@ _python_verify_patterns() {
21 local impl pattern
22 for pattern; do
23 case ${pattern} in
24 - -[23]|3.[89]|3.10)
25 + -[23]|3.[89]|3.1[01])
26 continue
27 ;;
28 esac
29 @@ -132,7 +132,7 @@ _python_set_impls() {
30 # please keep them in sync with _PYTHON_ALL_IMPLS
31 # and _PYTHON_HISTORICAL_IMPLS
32 case ${i} in
33 - pypy3|python2_7|python3_[89]|python3_10)
34 + pypy3|python2_7|python3_[89]|python3_1[01])
35 ;;
36 jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7])
37 obsolete+=( "${i}" )
38 @@ -245,7 +245,7 @@ _python_impl_matches() {
39 [[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
40 return 0
41 ;;
42 - 3.8|3.10)
43 + 3.8|3.1[01])
44 [[ ${impl} == python${pattern/./_} ]] && return 0
45 ;;
46 *)
47 @@ -461,6 +461,8 @@ _python_export() {
48 PYTHON_PKG_DEP=">=dev-lang/python-3.9.9-r1:3.9";;
49 python3.10)
50 PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";;
51 + python3.11)
52 + PYTHON_PKG_DEP=">=dev-lang/python-3.11.0_beta1:3.11";;
53 python*)
54 PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
55 pypy)
56 diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
57 index 9c41798c4727..e0fc0aab3c03 100755
58 --- a/eclass/tests/python-utils-r1.sh
59 +++ b/eclass/tests/python-utils-r1.sh
60 @@ -147,6 +147,20 @@ fi
61 test_var PYTHON_PKG_DEP python3_10 '*dev-lang/python*:3.10'
62 test_var PYTHON_SCRIPTDIR python3_10 /usr/lib/python-exec/python3.10
63
64 +test_var EPYTHON python3_11 python3.11
65 +test_var PYTHON python3_11 /usr/bin/python3.11
66 +if [[ -x /usr/bin/python3.11 ]]; then
67 + abiflags=$(/usr/bin/python3.11 -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS"))')
68 + test_var PYTHON_SITEDIR python3_11 "/usr/lib/python3.11/site-packages"
69 + test_var PYTHON_INCLUDEDIR python3_11 "/usr/include/python3.11${abiflags}"
70 + test_var PYTHON_LIBPATH python3_11 "/usr/lib*/libpython3.11${abiflags}$(get_libname)"
71 + test_var PYTHON_CONFIG python3_11 "/usr/bin/python3.11${abiflags}-config"
72 + test_var PYTHON_CFLAGS python3_11 "*-I/usr/include/python3.11*"
73 + test_var PYTHON_LIBS python3_11 "*-lpython3.11*"
74 +fi
75 +test_var PYTHON_PKG_DEP python3_11 '*dev-lang/python*:3.11'
76 +test_var PYTHON_SCRIPTDIR python3_11 /usr/lib/python-exec/python3.11
77 +
78 test_var EPYTHON pypy3 pypy3
79 test_var PYTHON pypy3 /usr/bin/pypy3
80 if [[ -x /usr/bin/pypy3 ]]; then
81 --
82 2.35.1