Gentoo Archives: gentoo-dev

From: David Seifert <soap@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, David Seifert <soap@g.o>
Subject: [gentoo-dev] [PATCH 2/3] python-utils-r1.eclass: Constrain to EAPI >= 5
Date: Sat, 14 Dec 2019 10:51:20
Message-Id: 20191214105036.315604-2-soap@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/3] python-any-r1.eclass: Constrain to EAPI >= 5 by David Seifert
1 Signed-off-by: David Seifert <soap@g.o>
2 ---
3 eclass/python-utils-r1.eclass | 32 +++++++++-----------------------
4 1 file changed, 9 insertions(+), 23 deletions(-)
5
6 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
7 index 3eadc50f93e..779e228e4dc 100644
8 --- a/eclass/python-utils-r1.eclass
9 +++ b/eclass/python-utils-r1.eclass
10 @@ -7,7 +7,7 @@
11 # @AUTHOR:
12 # Author: Michał Górny <mgorny@g.o>
13 # Based on work of: Krzysztof Pawlik <nelchael@g.o>
14 -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
15 +# @SUPPORTED_EAPIS: 5 6 7
16 # @BLURB: Utility functions for packages with Python parts.
17 # @DESCRIPTION:
18 # A utility eclass providing functions to query Python implementations,
19 @@ -20,7 +20,10 @@
20 # https://wiki.gentoo.org/wiki/Project:Python/python-utils-r1
21
22 case "${EAPI:-0}" in
23 - 0|1|2|3|4|5|6|7)
24 + [01234])
25 + die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
26 + ;;
27 + [567])
28 ;;
29 *)
30 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
31 @@ -33,7 +36,7 @@ fi
32
33 if [[ ! ${_PYTHON_UTILS_R1} ]]; then
34
35 -[[ ${EAPI:-0} == [012345] ]] && inherit eutils multilib
36 +[[ ${EAPI} == 5 ]] && inherit eutils multilib
37 inherit toolchain-funcs
38
39 # @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
40 @@ -80,17 +83,12 @@ _python_impl_supported() {
41 # keep in sync with _PYTHON_ALL_IMPLS!
42 # (not using that list because inline patterns shall be faster)
43 case "${impl}" in
44 - python2_7|python3_[5678]|jython2_7)
45 + python2_7|python3_[5678]|jython2_7|pypy|pypy3)
46 return 0
47 ;;
48 pypy1_[89]|pypy2_0|python2_[56]|python3_[1234])
49 return 1
50 ;;
51 - pypy|pypy3)
52 - if [[ ${EAPI:-0} == [01234] ]]; then
53 - die "PyPy is supported in EAPI 5 and newer only."
54 - fi
55 - ;;
56 *)
57 [[ ${PYTHON_COMPAT_NO_STRICT} ]] && return 1
58 die "Invalid implementation in PYTHON_COMPAT: ${impl}"
59 @@ -776,9 +774,6 @@ python_newexe() {
60
61 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
62 [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
63 - if [[ ${EAPI:-0} == [0123] ]]; then
64 - die "python_do* and python_new* helpers are banned in EAPIs older than 4."
65 - fi
66
67 local wrapd=${python_scriptroot:-/usr/bin}
68
69 @@ -906,9 +901,6 @@ python_domodule() {
70 debug-print-function ${FUNCNAME} "${@}"
71
72 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
73 - if [[ ${EAPI:-0} == [0123] ]]; then
74 - die "python_do* and python_new* helpers are banned in EAPIs older than 4."
75 - fi
76
77 local d
78 if [[ ${python_moduleroot} == /* ]]; then
79 @@ -948,9 +940,6 @@ python_doheader() {
80 debug-print-function ${FUNCNAME} "${@}"
81
82 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
83 - if [[ ${EAPI:-0} == [0123] ]]; then
84 - die "python_do* and python_new* helpers are banned in EAPIs older than 4."
85 - fi
86
87 local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
88 [[ ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR
89 @@ -1093,10 +1082,7 @@ python_is_installed() {
90 [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
91 local hasv_args=()
92
93 - case ${EAPI:-0} in
94 - 0|1|2|3|4)
95 - local -x ROOT=/
96 - ;;
97 + case ${EAPI} in
98 5|6)
99 hasv_args+=( --host-root )
100 ;;
101 @@ -1265,7 +1251,7 @@ python_fix_shebang() {
102
103 if [[ ! ${any_fixed} ]]; then
104 local cmd=eerror
105 - [[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn
106 + [[ ${EAPI} == 5 ]] && cmd=eqawarn
107
108 "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
109 if [[ ${any_correct} ]]; then
110 --
111 2.24.1