1 |
Fix distutils-r1 phase functions to correctly pass through the return |
2 |
value from the subphases. This fixes e.g. the mistake of virtx |
3 |
not failing in the following case: |
4 |
|
5 |
src_test() { |
6 |
virtx distutils-r1_src_test |
7 |
} |
8 |
|
9 |
python_test() { |
10 |
epytest |
11 |
} |
12 |
|
13 |
This is because virtx implicitly uses nonfatal and epytest uses |
14 |
`die -n`. However, since the return value was not passed through, virtx |
15 |
never knew that anything has failed. |
16 |
|
17 |
While this covers only trivial cases and this is better solved via dying |
18 |
explicitly in the redefined python_test(), there's no harm in adding |
19 |
this passthrough. |
20 |
|
21 |
Signed-off-by: Michał Górny <mgorny@g.o> |
22 |
--- |
23 |
eclass/distutils-r1.eclass | 48 ++++++++++++++++++++++++++------------ |
24 |
1 file changed, 33 insertions(+), 15 deletions(-) |
25 |
|
26 |
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass |
27 |
index a81d95f4eb6e..8942a6149c93 100644 |
28 |
--- a/eclass/distutils-r1.eclass |
29 |
+++ b/eclass/distutils-r1.eclass |
30 |
@@ -1319,8 +1319,10 @@ distutils-r1_run_phase() { |
31 |
local -x LDSHARED="${CC} ${ldopts}" LDCXXSHARED="${CXX} ${ldopts}" |
32 |
|
33 |
"${@}" |
34 |
+ local ret=${?} |
35 |
|
36 |
cd "${_DISTUTILS_INITIAL_CWD}" || die |
37 |
+ return "${ret}" |
38 |
} |
39 |
|
40 |
# @FUNCTION: _distutils-r1_run_common_phase |
41 |
@@ -1378,14 +1380,14 @@ _distutils-r1_run_foreach_impl() { |
42 |
|
43 |
distutils-r1_src_prepare() { |
44 |
debug-print-function ${FUNCNAME} "${@}" |
45 |
- |
46 |
+ local ret=0 |
47 |
local _DISTUTILS_DEFAULT_CALLED |
48 |
|
49 |
# common preparations |
50 |
if declare -f python_prepare_all >/dev/null; then |
51 |
- python_prepare_all |
52 |
+ python_prepare_all || ret=${?} |
53 |
else |
54 |
- distutils-r1_python_prepare_all |
55 |
+ distutils-r1_python_prepare_all || ret=${?} |
56 |
fi |
57 |
|
58 |
if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then |
59 |
@@ -1393,35 +1395,45 @@ distutils-r1_src_prepare() { |
60 |
fi |
61 |
|
62 |
if declare -f python_prepare >/dev/null; then |
63 |
- _distutils-r1_run_foreach_impl python_prepare |
64 |
+ _distutils-r1_run_foreach_impl python_prepare || ret=${?} |
65 |
fi |
66 |
+ |
67 |
+ return ${ret} |
68 |
} |
69 |
|
70 |
distutils-r1_src_configure() { |
71 |
+ debug-print-function ${FUNCNAME} "${@}" |
72 |
+ local ret=0 |
73 |
+ |
74 |
python_export_utf8_locale |
75 |
[[ ${EAPI} == 6 ]] && xdg_environment_reset # Bug 577704 |
76 |
|
77 |
if declare -f python_configure >/dev/null; then |
78 |
- _distutils-r1_run_foreach_impl python_configure |
79 |
+ _distutils-r1_run_foreach_impl python_configure || ret=${?} |
80 |
fi |
81 |
|
82 |
if declare -f python_configure_all >/dev/null; then |
83 |
- _distutils-r1_run_common_phase python_configure_all |
84 |
+ _distutils-r1_run_common_phase python_configure_all || ret=${?} |
85 |
fi |
86 |
+ |
87 |
+ return ${ret} |
88 |
} |
89 |
|
90 |
distutils-r1_src_compile() { |
91 |
debug-print-function ${FUNCNAME} "${@}" |
92 |
+ local ret=0 |
93 |
|
94 |
if declare -f python_compile >/dev/null; then |
95 |
- _distutils-r1_run_foreach_impl python_compile |
96 |
+ _distutils-r1_run_foreach_impl python_compile || ret=${?} |
97 |
else |
98 |
- _distutils-r1_run_foreach_impl distutils-r1_python_compile |
99 |
+ _distutils-r1_run_foreach_impl distutils-r1_python_compile || ret=${?} |
100 |
fi |
101 |
|
102 |
if declare -f python_compile_all >/dev/null; then |
103 |
- _distutils-r1_run_common_phase python_compile_all |
104 |
+ _distutils-r1_run_common_phase python_compile_all || ret=${?} |
105 |
fi |
106 |
+ |
107 |
+ return ${ret} |
108 |
} |
109 |
|
110 |
# @FUNCTION: _distutils-r1_clean_egg_info |
111 |
@@ -1440,17 +1452,20 @@ _distutils-r1_clean_egg_info() { |
112 |
|
113 |
distutils-r1_src_test() { |
114 |
debug-print-function ${FUNCNAME} "${@}" |
115 |
+ local ret=0 |
116 |
|
117 |
if declare -f python_test >/dev/null; then |
118 |
- _distutils-r1_run_foreach_impl python_test |
119 |
+ _distutils-r1_run_foreach_impl python_test || ret=${?} |
120 |
if [[ ! ${DISTUTILS_USE_PEP517} ]]; then |
121 |
_distutils-r1_run_foreach_impl _distutils-r1_clean_egg_info |
122 |
fi |
123 |
fi |
124 |
|
125 |
if declare -f python_test_all >/dev/null; then |
126 |
- _distutils-r1_run_common_phase python_test_all |
127 |
+ _distutils-r1_run_common_phase python_test_all || ret=${?} |
128 |
fi |
129 |
+ |
130 |
+ return ${ret} |
131 |
} |
132 |
|
133 |
# @FUNCTION: _distutils-r1_check_namespace_pth |
134 |
@@ -1482,20 +1497,23 @@ _distutils-r1_check_namespace_pth() { |
135 |
|
136 |
distutils-r1_src_install() { |
137 |
debug-print-function ${FUNCNAME} "${@}" |
138 |
+ local ret=0 |
139 |
|
140 |
if declare -f python_install >/dev/null; then |
141 |
- _distutils-r1_run_foreach_impl python_install |
142 |
+ _distutils-r1_run_foreach_impl python_install || ret=${?} |
143 |
else |
144 |
- _distutils-r1_run_foreach_impl distutils-r1_python_install |
145 |
+ _distutils-r1_run_foreach_impl distutils-r1_python_install || ret=${?} |
146 |
fi |
147 |
|
148 |
if declare -f python_install_all >/dev/null; then |
149 |
- _distutils-r1_run_common_phase python_install_all |
150 |
+ _distutils-r1_run_common_phase python_install_all || ret=${?} |
151 |
else |
152 |
- _distutils-r1_run_common_phase distutils-r1_python_install_all |
153 |
+ _distutils-r1_run_common_phase distutils-r1_python_install_all || ret=${?} |
154 |
fi |
155 |
|
156 |
_distutils-r1_check_namespace_pth |
157 |
+ |
158 |
+ return ${ret} |
159 |
} |
160 |
|
161 |
_DISTUTILS_R1=1 |
162 |
-- |
163 |
2.35.1 |