commit:     038461565b477877de1ff09e282ca786ffbad8ce
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 00:48:32 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 30 12:58:49 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03846156

python-utils-r1.eclass: Constrain to EAPI >= 5

Signed-off-by: David Seifert <soap <AT> gentoo.org>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-utils-r1.eclass | 37 +++++++++----------------------------
 1 file changed, 9 insertions(+), 28 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 3eadc50f93e..e0711a35e3a 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: python-utils-r1.eclass
@@ -7,7 +7,7 @@
 # @AUTHOR:
 # Author: Michał Górny <[email protected]>
 # Based on work of: Krzysztof Pawlik <[email protected]>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: Utility functions for packages with Python parts.
 # @DESCRIPTION:
 # A utility eclass providing functions to query Python implementations,
@@ -20,11 +20,9 @@
 # https://wiki.gentoo.org/wiki/Project:Python/python-utils-r1
 
 case "${EAPI:-0}" in
-       0|1|2|3|4|5|6|7)
-               ;;
-       *)
-               die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
-               ;;
+       [0-4]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
+       [5-7]) ;;
+       *)     die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
 esac
 
 if [[ ${_PYTHON_ECLASS_INHERITED} ]]; then
@@ -33,7 +31,7 @@ fi
 
 if [[ ! ${_PYTHON_UTILS_R1} ]]; then
 
-[[ ${EAPI:-0} == [012345] ]] && inherit eutils multilib
+[[ ${EAPI} == 5 ]] && inherit eutils multilib
 inherit toolchain-funcs
 
 # @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
@@ -80,17 +78,12 @@ _python_impl_supported() {
        # keep in sync with _PYTHON_ALL_IMPLS!
        # (not using that list because inline patterns shall be faster)
        case "${impl}" in
-               python2_7|python3_[5678]|jython2_7)
+               python2_7|python3_[5678]|jython2_7|pypy|pypy3)
                        return 0
                        ;;
                pypy1_[89]|pypy2_0|python2_[56]|python3_[1234])
                        return 1
                        ;;
-               pypy|pypy3)
-                       if [[ ${EAPI:-0} == [01234] ]]; then
-                               die "PyPy is supported in EAPI 5 and newer 
only."
-                       fi
-                       ;;
                *)
                        [[ ${PYTHON_COMPAT_NO_STRICT} ]] && return 1
                        die "Invalid implementation in PYTHON_COMPAT: ${impl}"
@@ -776,9 +769,6 @@ python_newexe() {
 
        [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is 
null).'
        [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
-       if [[ ${EAPI:-0} == [0123] ]]; then
-               die "python_do* and python_new* helpers are banned in EAPIs 
older than 4."
-       fi
 
        local wrapd=${python_scriptroot:-/usr/bin}
 
@@ -906,9 +896,6 @@ python_domodule() {
        debug-print-function ${FUNCNAME} "${@}"
 
        [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is 
null).'
-       if [[ ${EAPI:-0} == [0123] ]]; then
-               die "python_do* and python_new* helpers are banned in EAPIs 
older than 4."
-       fi
 
        local d
        if [[ ${python_moduleroot} == /* ]]; then
@@ -948,9 +935,6 @@ python_doheader() {
        debug-print-function ${FUNCNAME} "${@}"
 
        [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is 
null).'
-       if [[ ${EAPI:-0} == [0123] ]]; then
-               die "python_do* and python_new* helpers are banned in EAPIs 
older than 4."
-       fi
 
        local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
        [[ ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR
@@ -1093,10 +1077,7 @@ python_is_installed() {
        [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
        local hasv_args=()
 
-       case ${EAPI:-0} in
-               0|1|2|3|4)
-                       local -x ROOT=/
-                       ;;
+       case ${EAPI} in
                5|6)
                        hasv_args+=( --host-root )
                        ;;
@@ -1265,7 +1246,7 @@ python_fix_shebang() {
 
                if [[ ! ${any_fixed} ]]; then
                        local cmd=eerror
-                       [[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn
+                       [[ ${EAPI} == 5 ]] && cmd=eqawarn
 
                        "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did 
not match any fixable files."
                        if [[ ${any_correct} ]]; then

Reply via email to