diff options
author | Michał Górny <mgorny@gentoo.org> | 2021-06-20 09:44:25 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2021-06-23 23:44:07 +0200 |
commit | 98a94936c2dead2b4a52489a37b4c43557215e1b (patch) | |
tree | dce355c1d7691d32e0f8ea56c54beba21e7acebc /eclass | |
parent | python-utils-r1.eclass: Eliminate local python_is_python3 uses (diff) | |
download | gentoo-98a94936c2dead2b4a52489a37b4c43557215e1b.tar.gz gentoo-98a94936c2dead2b4a52489a37b4c43557215e1b.tar.bz2 gentoo-98a94936c2dead2b4a52489a37b4c43557215e1b.zip |
python-utils-r1.eclass: Ban py2 deps in python_gen* in EAPI 8
Ban using -2 or python2* as an argument to python_gen_cond_dep and other
functions using _python_impl_matches, in order to force cleaning up old
entries, in EAPI 8.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/python-utils-r1.eclass | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index b137370f4f86..1a20a3cae994 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -189,11 +189,8 @@ _python_set_impls() { # of the patterns following it. Return 0 if it does, 1 otherwise. # Matches if no patterns are provided. # -# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be -# either: -# a) fnmatch-style patterns, e.g. 'python2*', 'pypy'... -# b) '-2' to indicate all Python 2 variants -# c) '-3' to indicate all Python 3 variants +# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns +# are fnmatch-style. _python_impl_matches() { [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter" [[ ${#} -eq 1 ]] && return 0 @@ -202,14 +199,30 @@ _python_impl_matches() { shift for pattern; do - if [[ ${pattern} == -2 ]]; then - : - elif [[ ${pattern} == -3 ]]; then - return 0 - # unify value style to allow lax matching - elif [[ ${impl/./_} == ${pattern/./_} ]]; then - return 0 - fi + case ${pattern} in + -2|python2*|pypy) + if [[ ${EAPI} != [67] ]]; then + eerror + eerror "Python 2 is no longer supported in Gentoo, please remove Python 2" + eerror "${FUNCNAME[1]} calls." + die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}" + fi + ;; + -3) + # NB: "python3*" is fine, as "not pypy3" + if [[ ${EAPI} != [67] ]]; then + eerror + eerror "Python 2 is no longer supported in Gentoo, please remove Python 2" + eerror "${FUNCNAME[1]} calls." + die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}" + fi + return 0 + ;; + *) + # unify value style to allow lax matching + [[ ${impl/./_} == ${pattern/./_} ]] && return 0 + ;; + esac done return 1 |