1 |
Signed-off-by: Michał Górny <mgorny@g.o> |
2 |
--- |
3 |
eclass/python-utils-r1.eclass | 46 ++++++++++------------------------- |
4 |
1 file changed, 13 insertions(+), 33 deletions(-) |
5 |
|
6 |
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
7 |
index d0bfb7819059..55cf5f3404d7 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: 5 6 7 |
15 |
+# @SUPPORTED_EAPIS: 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,8 +20,8 @@ |
20 |
# https://dev.gentoo.org/~mgorny/python-guide/ |
21 |
|
22 |
case "${EAPI:-0}" in |
23 |
- [0-4]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;; |
24 |
- [5-7]) ;; |
25 |
+ [0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;; |
26 |
+ [6-7]) ;; |
27 |
*) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;; |
28 |
esac |
29 |
|
30 |
@@ -31,7 +31,6 @@ fi |
31 |
|
32 |
if [[ ! ${_PYTHON_UTILS_R1} ]]; then |
33 |
|
34 |
-[[ ${EAPI} == 5 ]] && inherit eutils multilib |
35 |
inherit toolchain-funcs |
36 |
|
37 |
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS |
38 |
@@ -1013,16 +1012,8 @@ python_is_python3() { |
39 |
python_is_installed() { |
40 |
local impl=${1:-${EPYTHON}} |
41 |
[[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON" |
42 |
- local hasv_args=() |
43 |
- |
44 |
- case ${EAPI} in |
45 |
- 5|6) |
46 |
- hasv_args+=( --host-root ) |
47 |
- ;; |
48 |
- *) |
49 |
- hasv_args+=( -b ) |
50 |
- ;; |
51 |
- esac |
52 |
+ local hasv_args=( -b ) |
53 |
+ [[ ${EAPI} == 6 ]] && hasv_args=( --host-root ) |
54 |
|
55 |
local PYTHON_PKG_DEP |
56 |
_python_export "${impl}" PYTHON_PKG_DEP |
57 |
@@ -1169,17 +1160,14 @@ python_fix_shebang() { |
58 |
done < <(find -H "${path}" -type f -print0 || die) |
59 |
|
60 |
if [[ ! ${any_fixed} ]]; then |
61 |
- local cmd=eerror |
62 |
- [[ ${EAPI} == 5 ]] && cmd=eqawarn |
63 |
- |
64 |
- "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files." |
65 |
+ eerror "QA error: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files." |
66 |
if [[ ${any_correct} ]]; then |
67 |
- "${cmd}" "All files have ${EPYTHON} shebang already." |
68 |
+ eerror "All files have ${EPYTHON} shebang already." |
69 |
else |
70 |
- "${cmd}" "There are no Python files in specified directory." |
71 |
+ eerror "There are no Python files in specified directory." |
72 |
fi |
73 |
|
74 |
- [[ ${cmd} == eerror ]] && die "${FUNCNAME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})" |
75 |
+ die "${FUNCNAME} did not match any fixable files" |
76 |
fi |
77 |
done |
78 |
} |
79 |
@@ -1282,20 +1270,16 @@ build_sphinx() { |
80 |
# Run pytest, passing the standard set of pytest options, followed |
81 |
# by user-specified options. |
82 |
# |
83 |
-# This command dies on failure and respects nonfatal in EAPIs supporting |
84 |
-# nonfatal die. |
85 |
+# This command dies on failure and respects nonfatal. |
86 |
epytest() { |
87 |
debug-print-function ${FUNCNAME} "${@}" |
88 |
|
89 |
[[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context" |
90 |
|
91 |
- local die_args=() |
92 |
- [[ ${EAPI} != [45] ]] && die_args+=( -n ) |
93 |
- |
94 |
set -- "${EPYTHON}" -m pytest -vv -ra "${@}" |
95 |
|
96 |
echo "${@}" >&2 |
97 |
- "${@}" || die "${die_args[@]}" "pytest failed with ${EPYTHON}" |
98 |
+ "${@}" || die -n "pytest failed with ${EPYTHON}" |
99 |
return ${?} |
100 |
} |
101 |
|
102 |
@@ -1305,20 +1289,16 @@ epytest() { |
103 |
# Run unit tests using dev-python/unittest-or-fail, passing the standard |
104 |
# set of options, followed by user-specified options. |
105 |
# |
106 |
-# This command dies on failure and respects nonfatal in EAPIs supporting |
107 |
-# nonfatal die. |
108 |
+# This command dies on failure and respects nonfatal. |
109 |
eunittest() { |
110 |
debug-print-function ${FUNCNAME} "${@}" |
111 |
|
112 |
[[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context" |
113 |
|
114 |
- local die_args=() |
115 |
- [[ ${EAPI} != [45] ]] && die_args+=( -n ) |
116 |
- |
117 |
set -- "${EPYTHON}" -m unittest_or_fail discover -v "${@}" |
118 |
|
119 |
echo "${@}" >&2 |
120 |
- "${@}" || die "${die_args[@]}" "Tests failed with ${EPYTHON}" |
121 |
+ "${@}" || die -n "Tests failed with ${EPYTHON}" |
122 |
return ${?} |
123 |
} |
124 |
|
125 |
-- |
126 |
2.31.1 |