1 |
Ban using -2 or python2* as an argument to python_gen_cond_dep and other |
2 |
functions using _python_impl_matches, in order to force cleaning up old |
3 |
entries, in EAPI 8. |
4 |
|
5 |
Signed-off-by: Michał Górny <mgorny@g.o> |
6 |
--- |
7 |
eclass/python-utils-r1.eclass | 39 +++++++++++++++++++++++------------ |
8 |
1 file changed, 26 insertions(+), 13 deletions(-) |
9 |
|
10 |
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
11 |
index 509b1b4288ac..1ff794ede1de 100644 |
12 |
--- a/eclass/python-utils-r1.eclass |
13 |
+++ b/eclass/python-utils-r1.eclass |
14 |
@@ -188,11 +188,8 @@ _python_set_impls() { |
15 |
# of the patterns following it. Return 0 if it does, 1 otherwise. |
16 |
# Matches if no patterns are provided. |
17 |
# |
18 |
-# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be |
19 |
-# either: |
20 |
-# a) fnmatch-style patterns, e.g. 'python2*', 'pypy'... |
21 |
-# b) '-2' to indicate all Python 2 variants |
22 |
-# c) '-3' to indicate all Python 3 variants |
23 |
+# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns |
24 |
+# are fnmatch-style. |
25 |
_python_impl_matches() { |
26 |
[[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter" |
27 |
[[ ${#} -eq 1 ]] && return 0 |
28 |
@@ -201,14 +198,30 @@ _python_impl_matches() { |
29 |
shift |
30 |
|
31 |
for pattern; do |
32 |
- if [[ ${pattern} == -2 ]]; then |
33 |
- : |
34 |
- elif [[ ${pattern} == -3 ]]; then |
35 |
- return 0 |
36 |
- # unify value style to allow lax matching |
37 |
- elif [[ ${impl/./_} == ${pattern/./_} ]]; then |
38 |
- return 0 |
39 |
- fi |
40 |
+ case ${pattern} in |
41 |
+ -2|python2*|pypy) |
42 |
+ if [[ ${EAPI} != [67] ]]; then |
43 |
+ eerror |
44 |
+ eerror "Python 2 is no longer supported in Gentoo, please remove Python 2" |
45 |
+ eerror "${FUNCNAME[1]} calls." |
46 |
+ die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}" |
47 |
+ fi |
48 |
+ ;; |
49 |
+ -3) |
50 |
+ # NB: "python3*" is fine, as "not pypy3" |
51 |
+ if [[ ${EAPI} != [67] ]]; then |
52 |
+ eerror |
53 |
+ eerror "Python 2 is no longer supported in Gentoo, please remove Python 2" |
54 |
+ eerror "${FUNCNAME[1]} calls." |
55 |
+ die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}" |
56 |
+ fi |
57 |
+ return 0 |
58 |
+ ;; |
59 |
+ *) |
60 |
+ # unify value style to allow lax matching |
61 |
+ [[ ${impl/./_} == ${pattern/./_} ]] && return 0 |
62 |
+ ;; |
63 |
+ esac |
64 |
done |
65 |
|
66 |
return 1 |
67 |
-- |
68 |
2.32.0 |