1 |
Signed-off-by: Michał Górny <mgorny@g.o> |
2 |
--- |
3 |
eclass/python-utils-r1.eclass | 65 ++++++++++------------------------- |
4 |
1 file changed, 19 insertions(+), 46 deletions(-) |
5 |
|
6 |
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
7 |
index c0099fa756ad..84c37cd29d60 100644 |
8 |
--- a/eclass/python-utils-r1.eclass |
9 |
+++ b/eclass/python-utils-r1.eclass |
10 |
@@ -133,9 +133,9 @@ _python_set_impls() { |
11 |
# please keep them in sync with _PYTHON_ALL_IMPLS |
12 |
# and _PYTHON_HISTORICAL_IMPLS |
13 |
case ${i} in |
14 |
- pypy3|python2_7|python3_[89]|python3_1[01]) |
15 |
+ pypy3|python3_[89]|python3_1[01]) |
16 |
;; |
17 |
- jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7]) |
18 |
+ jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-7]) |
19 |
obsolete+=( "${i}" ) |
20 |
;; |
21 |
*) |
22 |
@@ -172,13 +172,7 @@ _python_set_impls() { |
23 |
done |
24 |
|
25 |
if [[ ! ${supp[@]} ]]; then |
26 |
- # special-case python2_7 for python-any-r1 |
27 |
- if [[ ${_PYTHON_ALLOW_PY27} ]] && has python2_7 "${PYTHON_COMPAT[@]}" |
28 |
- then |
29 |
- supp+=( python2_7 ) |
30 |
- else |
31 |
- die "No supported implementation in PYTHON_COMPAT." |
32 |
- fi |
33 |
+ die "No supported implementation in PYTHON_COMPAT." |
34 |
fi |
35 |
|
36 |
if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then |
37 |
@@ -412,10 +406,6 @@ _python_export() { |
38 |
local val |
39 |
|
40 |
case "${impl}" in |
41 |
- python2*|python3.6|python3.7*) |
42 |
- # python* up to 3.7 |
43 |
- val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die |
44 |
- ;; |
45 |
python*) |
46 |
# python3.8+ |
47 |
val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}-embed) || die |
48 |
@@ -454,8 +444,6 @@ _python_export() { |
49 |
PYTHON_PKG_DEP) |
50 |
local d |
51 |
case ${impl} in |
52 |
- python2.7) |
53 |
- PYTHON_PKG_DEP='>=dev-lang/python-2.7.10_p16:2.7';; |
54 |
python3.8) |
55 |
PYTHON_PKG_DEP=">=dev-lang/python-3.8.15_p3:3.8";; |
56 |
python3.9) |
57 |
@@ -466,8 +454,6 @@ _python_export() { |
58 |
PYTHON_PKG_DEP=">=dev-lang/python-3.11.0_p2:3.11";; |
59 |
python*) |
60 |
PYTHON_PKG_DEP="dev-lang/python:${impl#python}";; |
61 |
- pypy) |
62 |
- PYTHON_PKG_DEP='>=dev-python/pypy-7.3.9-r2:0=';; |
63 |
pypy3) |
64 |
PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.9_p9:0=';; |
65 |
*) |
66 |
@@ -643,11 +629,7 @@ python_optimize() { |
67 |
|
68 |
einfo "Optimize Python modules for ${instpath}" |
69 |
case "${EPYTHON}" in |
70 |
- python2.7|python3.[34]) |
71 |
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" |
72 |
- "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}" |
73 |
- ;; |
74 |
- python3.[5678]|pypy3) |
75 |
+ python3.8|pypy3) |
76 |
# both levels of optimization are separate since 3.5 |
77 |
"${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" |
78 |
"${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}" |
79 |
@@ -656,9 +638,12 @@ python_optimize() { |
80 |
python*) |
81 |
"${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}" |
82 |
;; |
83 |
- *) |
84 |
+ pypy) |
85 |
"${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" |
86 |
;; |
87 |
+ *) |
88 |
+ die "${FUNCNAME}: unexpected EPYTHON=${EPYTHON}" |
89 |
+ ;; |
90 |
esac |
91 |
done |
92 |
} |
93 |
@@ -955,15 +940,6 @@ _python_wrapper_setup() { |
94 |
local EPYTHON PYTHON |
95 |
_python_export "${impl}" EPYTHON PYTHON |
96 |
|
97 |
- local pyver pyother |
98 |
- if [[ ${EPYTHON} != python2* ]]; then |
99 |
- pyver=3 |
100 |
- pyother=2 |
101 |
- else |
102 |
- pyver=2 |
103 |
- pyother=3 |
104 |
- fi |
105 |
- |
106 |
# Python interpreter |
107 |
# note: we don't use symlinks because python likes to do some |
108 |
# symlink reading magic that breaks stuff |
109 |
@@ -972,10 +948,10 @@ _python_wrapper_setup() { |
110 |
#!/bin/sh |
111 |
exec "${PYTHON}" "\${@}" |
112 |
_EOF_ |
113 |
- cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die |
114 |
- chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die |
115 |
+ cp "${workdir}/bin/python" "${workdir}/bin/python3" || die |
116 |
+ chmod +x "${workdir}/bin/python" "${workdir}/bin/python3" || die |
117 |
|
118 |
- local nonsupp=( "python${pyother}" "python${pyother}-config" ) |
119 |
+ local nonsupp=( python2 python2-config ) |
120 |
|
121 |
# CPython-specific |
122 |
if [[ ${EPYTHON} == python* ]]; then |
123 |
@@ -984,24 +960,22 @@ _python_wrapper_setup() { |
124 |
exec "${PYTHON}-config" "\${@}" |
125 |
_EOF_ |
126 |
cp "${workdir}/bin/python-config" \ |
127 |
- "${workdir}/bin/python${pyver}-config" || die |
128 |
+ "${workdir}/bin/python3-config" || die |
129 |
chmod +x "${workdir}/bin/python-config" \ |
130 |
- "${workdir}/bin/python${pyver}-config" || die |
131 |
+ "${workdir}/bin/python3-config" || die |
132 |
|
133 |
# Python 2.6+. |
134 |
ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die |
135 |
|
136 |
# Python 2.7+. |
137 |
ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc \ |
138 |
- "${workdir}"/pkgconfig/python${pyver}.pc || die |
139 |
+ "${workdir}"/pkgconfig/python3.pc || die |
140 |
|
141 |
# Python 3.8+. |
142 |
- if [[ ${EPYTHON} != python[23].[67] ]]; then |
143 |
- ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \ |
144 |
- "${workdir}"/pkgconfig/python${pyver}-embed.pc || die |
145 |
- fi |
146 |
+ ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \ |
147 |
+ "${workdir}"/pkgconfig/python3-embed.pc || die |
148 |
else |
149 |
- nonsupp+=( 2to3 python-config "python${pyver}-config" ) |
150 |
+ nonsupp+=( 2to3 python-config python3-config ) |
151 |
fi |
152 |
|
153 |
local x |
154 |
@@ -1098,11 +1072,10 @@ python_fix_shebang() { |
155 |
"${EPYTHON}") |
156 |
match=1 |
157 |
;; |
158 |
- python|python[23]) |
159 |
+ python|python3) |
160 |
match=1 |
161 |
- [[ ${in_path##*/} == python2 ]] && error=1 |
162 |
;; |
163 |
- python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9]) |
164 |
+ python2|python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9]) |
165 |
# Explicit mismatch. |
166 |
match=1 |
167 |
error=1 |
168 |
-- |
169 |
2.38.1 |