summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-06-20 09:35:10 +0200
committerMichał Górny <mgorny@gentoo.org>2021-06-23 23:44:06 +0200
commitb3071fedb9d0d907173de2ce66478bd6d9770f93 (patch)
treea7787bcb237440a548edc84cc046a6dddd10803a /eclass/python-utils-r1.eclass
parentpython-utils-r1.eclass: Rename *into vars to use underscores (diff)
downloadgentoo-b3071fedb9d0d907173de2ce66478bd6d9770f93.tar.gz
gentoo-b3071fedb9d0d907173de2ce66478bd6d9770f93.tar.bz2
gentoo-b3071fedb9d0d907173de2ce66478bd6d9770f93.zip
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@gentoo.org>
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass16
1 files changed, 6 insertions, 10 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index a75709f19ea0..b137370f4f86 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