commit: b3071fedb9d0d907173de2ce66478bd6d9770f93
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 20 07:35:10 2021 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun 23 21:44:06 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3071fed
python-utils-r1.eclass: Eliminate local python_is_python3 uses
Do not use python_is_python3 in eclass functions to ease banning it.
Except for wrapper setup that is still used in py2 any-r1 context,
we can unconditionally assume Python 3 everywhere.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
eclass/python-utils-r1.eclass | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index a75709f19ea..b137370f4f8 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -192,8 +192,8 @@ _python_set_impls() {
# <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 (= !python_is_python3)
-# c) '-3' to indicate all Python 3 variants (= python_is_python3)
+# b) '-2' to indicate all Python 2 variants
+# c) '-3' to indicate all Python 3 variants
_python_impl_matches() {
[[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
[[ ${#} -eq 1 ]] && return 0
@@ -203,10 +203,9 @@ _python_impl_matches() {
for pattern; do
if [[ ${pattern} == -2 ]]; then
- python_is_python3 "${impl}" || return 0
+ :
elif [[ ${pattern} == -3 ]]; then
- python_is_python3 "${impl}" && return 0
- return
+ return 0
# unify value style to allow lax matching
elif [[ ${impl/./_} == ${pattern/./_} ]]; then
return 0
@@ -919,7 +918,7 @@ _python_wrapper_setup() {
_python_export "${impl}" EPYTHON PYTHON
local pyver pyother
- if python_is_python3; then
+ if [[ ${EPYTHON} != python2* ]]; then
pyver=3
pyother=2
else
@@ -1096,13 +1095,10 @@ python_fix_shebang() {
if [[ ${i} == *python2
]]; then
from=python2
if [[ !
${force} ]]; then
-
python_is_python3 "${EPYTHON}" && error=1
+ error=1
fi
elif [[ ${i} ==
*python3 ]]; then
from=python3
- if [[ !
${force} ]]; then
-
python_is_python3 "${EPYTHON}" || error=1
- fi
else
from=python
fi