1 |
Signed-off-by: Michał Górny <mgorny@g.o> |
2 |
--- |
3 |
eclass/distutils-r2.eclass | 2 +- |
4 |
eclass/python-any-r2.eclass | 12 +-- |
5 |
eclass/python-r2.eclass | 12 +-- |
6 |
eclass/python-single-r2.eclass | 8 +- |
7 |
eclass/python-utils-r2.eclass | 149 ++++---------------------------- |
8 |
eclass/tests/python-utils-r2.sh | 2 +- |
9 |
6 files changed, 36 insertions(+), 149 deletions(-) |
10 |
|
11 |
diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass |
12 |
index e17345b58221..99d93a2e830f 100644 |
13 |
--- a/eclass/distutils-r2.eclass |
14 |
+++ b/eclass/distutils-r2.eclass |
15 |
@@ -733,7 +733,7 @@ _distutils-r2_wrap_scripts() { |
16 |
local bindir=${2} |
17 |
|
18 |
local PYTHON_SCRIPTDIR |
19 |
- python_export PYTHON_SCRIPTDIR |
20 |
+ _python_export PYTHON_SCRIPTDIR |
21 |
|
22 |
local f python_files=() non_python_files=() |
23 |
|
24 |
diff --git a/eclass/python-any-r2.eclass b/eclass/python-any-r2.eclass |
25 |
index b85de5f7b32d..053bf4b5a0e3 100644 |
26 |
--- a/eclass/python-any-r2.eclass |
27 |
+++ b/eclass/python-any-r2.eclass |
28 |
@@ -150,7 +150,7 @@ _python_any_set_globals() { |
29 |
_python_set_impls |
30 |
|
31 |
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do |
32 |
- python_export "${i}" PYTHON_PKG_DEP |
33 |
+ _python_export "${i}" PYTHON_PKG_DEP |
34 |
|
35 |
# note: need to strip '=' slot operator for || deps |
36 |
deps="${PYTHON_PKG_DEP/:0=/:0} ${deps}" |
37 |
@@ -231,7 +231,7 @@ python_gen_any_dep() { |
38 |
local i PYTHON_PKG_DEP out= |
39 |
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do |
40 |
local PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)" |
41 |
- python_export "${i}" PYTHON_PKG_DEP |
42 |
+ _python_export "${i}" PYTHON_PKG_DEP |
43 |
|
44 |
local i_depstr=${depstr//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}} |
45 |
# note: need to strip '=' slot operator for || deps |
46 |
@@ -298,7 +298,7 @@ python_setup() { |
47 |
ewarn |
48 |
ewarn "Dependencies won't be satisfied, and EPYTHON/eselect-python will be ignored." |
49 |
|
50 |
- python_export "${impls[0]}" EPYTHON PYTHON |
51 |
+ _python_export "${impls[0]}" EPYTHON PYTHON |
52 |
_python_wrapper_setup |
53 |
einfo "Using ${EPYTHON} to build" |
54 |
return |
55 |
@@ -307,7 +307,7 @@ python_setup() { |
56 |
# first, try ${EPYTHON}... maybe it's good enough for us. |
57 |
if [[ ${EPYTHON} ]]; then |
58 |
if _python_EPYTHON_supported "${EPYTHON}"; then |
59 |
- python_export EPYTHON PYTHON |
60 |
+ _python_export EPYTHON PYTHON |
61 |
_python_wrapper_setup |
62 |
einfo "Using ${EPYTHON} to build" |
63 |
return |
64 |
@@ -323,7 +323,7 @@ python_setup() { |
65 |
# no eselect-python? |
66 |
break |
67 |
elif _python_EPYTHON_supported "${i}"; then |
68 |
- python_export "${i}" EPYTHON PYTHON |
69 |
+ _python_export "${i}" EPYTHON PYTHON |
70 |
_python_wrapper_setup |
71 |
einfo "Using ${EPYTHON} to build" |
72 |
return |
73 |
@@ -333,7 +333,7 @@ python_setup() { |
74 |
# fallback to best installed impl. |
75 |
# (reverse iteration over _PYTHON_SUPPORTED_IMPLS) |
76 |
for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do |
77 |
- python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON |
78 |
+ _python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON |
79 |
if _python_EPYTHON_supported "${EPYTHON}"; then |
80 |
_python_wrapper_setup |
81 |
einfo "Using ${EPYTHON} to build" |
82 |
diff --git a/eclass/python-r2.eclass b/eclass/python-r2.eclass |
83 |
index a96098fe65cf..02b60d4e4de9 100644 |
84 |
--- a/eclass/python-r2.eclass |
85 |
+++ b/eclass/python-r2.eclass |
86 |
@@ -172,7 +172,7 @@ _python_set_globals() { |
87 |
_python_set_impls |
88 |
|
89 |
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do |
90 |
- python_export "${i}" PYTHON_PKG_DEP |
91 |
+ _python_export "${i}" PYTHON_PKG_DEP |
92 |
deps+="python_targets_${i}? ( ${PYTHON_PKG_DEP} ) " |
93 |
done |
94 |
|
95 |
@@ -443,7 +443,7 @@ python_gen_impl_dep() { |
96 |
for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do |
97 |
if _python_impl_matches "${impl}" "${@}"; then |
98 |
local PYTHON_PKG_DEP |
99 |
- python_export "${impl}" PYTHON_PKG_DEP |
100 |
+ _python_export "${impl}" PYTHON_PKG_DEP |
101 |
matches+=( "python_targets_${impl}? ( ${PYTHON_PKG_DEP} )" ) |
102 |
fi |
103 |
done |
104 |
@@ -521,7 +521,7 @@ python_gen_any_dep() { |
105 |
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do |
106 |
if _python_impl_matches "${i}" "${@}"; then |
107 |
local PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)" |
108 |
- python_export "${i}" PYTHON_PKG_DEP |
109 |
+ _python_export "${i}" PYTHON_PKG_DEP |
110 |
|
111 |
local i_depstr=${depstr//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}} |
112 |
# note: need to strip '=' slot operator for || deps |
113 |
@@ -595,7 +595,7 @@ _python_multibuild_wrapper() { |
114 |
|
115 |
local -x EPYTHON PYTHON |
116 |
local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH} |
117 |
- python_export "${MULTIBUILD_VARIANT}" EPYTHON PYTHON |
118 |
+ _python_export "${MULTIBUILD_VARIANT}" EPYTHON PYTHON |
119 |
_python_wrapper_setup |
120 |
|
121 |
"${@}" |
122 |
@@ -718,7 +718,7 @@ python_setup() { |
123 |
# check patterns |
124 |
_python_impl_matches "${impl}" "${@}" || continue |
125 |
|
126 |
- python_export "${impl}" EPYTHON PYTHON |
127 |
+ _python_export "${impl}" EPYTHON PYTHON |
128 |
|
129 |
# if python_check_deps() is declared, switch into any-of mode |
130 |
if [[ ${has_check_deps} ]]; then |
131 |
@@ -761,7 +761,7 @@ python_replicate_script() { |
132 |
local _PYTHON_FIX_SHEBANG_QUIET=1 |
133 |
|
134 |
local PYTHON_SCRIPTDIR |
135 |
- python_export PYTHON_SCRIPTDIR |
136 |
+ _python_export PYTHON_SCRIPTDIR |
137 |
|
138 |
( |
139 |
exeopts -m 0755 |
140 |
diff --git a/eclass/python-single-r2.eclass b/eclass/python-single-r2.eclass |
141 |
index 0bd4d84eaa52..ce170c1d13c9 100644 |
142 |
--- a/eclass/python-single-r2.eclass |
143 |
+++ b/eclass/python-single-r2.eclass |
144 |
@@ -212,7 +212,7 @@ _python_single_set_globals() { |
145 |
|
146 |
local deps= i PYTHON_PKG_DEP |
147 |
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do |
148 |
- python_export "${i}" PYTHON_PKG_DEP |
149 |
+ _python_export "${i}" PYTHON_PKG_DEP |
150 |
# 1) well, python-exec would suffice as an RDEP |
151 |
# but no point in making this overcomplex, BDEP doesn't hurt anyone |
152 |
# 2) python-exec should be built with all targets forced anyway |
153 |
@@ -435,7 +435,7 @@ python_gen_impl_dep() { |
154 |
for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do |
155 |
if _python_impl_matches "${impl}" "${@}"; then |
156 |
local PYTHON_PKG_DEP |
157 |
- python_export "${impl}" PYTHON_PKG_DEP |
158 |
+ _python_export "${impl}" PYTHON_PKG_DEP |
159 |
matches+=( "python_single_target_${impl}? ( ${PYTHON_PKG_DEP} )" ) |
160 |
fi |
161 |
done |
162 |
@@ -464,7 +464,7 @@ python_setup() { |
163 |
ewarn |
164 |
ewarn "Dependencies won't be satisfied, and PYTHON_SINGLE_TARGET flags will be ignored." |
165 |
|
166 |
- python_export "${impls[0]}" EPYTHON PYTHON |
167 |
+ _python_export "${impls[0]}" EPYTHON PYTHON |
168 |
_python_wrapper_setup |
169 |
einfo "Using ${EPYTHON} to build" |
170 |
return |
171 |
@@ -482,7 +482,7 @@ python_setup() { |
172 |
die "More than one implementation in PYTHON_SINGLE_TARGET." |
173 |
fi |
174 |
|
175 |
- python_export "${impl}" EPYTHON PYTHON |
176 |
+ _python_export "${impl}" EPYTHON PYTHON |
177 |
_python_wrapper_setup |
178 |
einfo "Using ${EPYTHON} to build" |
179 |
fi |
180 |
diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass |
181 |
index ccac5677a323..dab4a5b5c87e 100644 |
182 |
--- a/eclass/python-utils-r2.eclass |
183 |
+++ b/eclass/python-utils-r2.eclass |
184 |
@@ -227,116 +227,9 @@ _python_impl_matches() { |
185 |
# python2.7 |
186 |
# @CODE |
187 |
|
188 |
-# @ECLASS-VARIABLE: PYTHON_SITEDIR |
189 |
-# @DEFAULT_UNSET |
190 |
-# @DESCRIPTION: |
191 |
-# The path to Python site-packages directory. |
192 |
-# |
193 |
-# Set and exported on request using python_export(). |
194 |
-# Requires a proper build-time dependency on the Python implementation. |
195 |
-# |
196 |
-# Example value: |
197 |
-# @CODE |
198 |
-# /usr/lib64/python2.7/site-packages |
199 |
-# @CODE |
200 |
- |
201 |
-# @ECLASS-VARIABLE: PYTHON_INCLUDEDIR |
202 |
-# @DEFAULT_UNSET |
203 |
-# @DESCRIPTION: |
204 |
-# The path to Python include directory. |
205 |
-# |
206 |
-# Set and exported on request using python_export(). |
207 |
-# Requires a proper build-time dependency on the Python implementation. |
208 |
-# |
209 |
-# Example value: |
210 |
-# @CODE |
211 |
-# /usr/include/python2.7 |
212 |
-# @CODE |
213 |
- |
214 |
-# @ECLASS-VARIABLE: PYTHON_LIBPATH |
215 |
-# @DEFAULT_UNSET |
216 |
-# @DESCRIPTION: |
217 |
-# The path to Python library. |
218 |
-# |
219 |
-# Set and exported on request using python_export(). |
220 |
-# Valid only for CPython. Requires a proper build-time dependency |
221 |
-# on the Python implementation. |
222 |
-# |
223 |
-# Example value: |
224 |
-# @CODE |
225 |
-# /usr/lib64/libpython2.7.so |
226 |
-# @CODE |
227 |
- |
228 |
-# @ECLASS-VARIABLE: PYTHON_CFLAGS |
229 |
-# @DEFAULT_UNSET |
230 |
-# @DESCRIPTION: |
231 |
-# Proper C compiler flags for building against Python. Obtained from |
232 |
-# pkg-config or python-config. |
233 |
-# |
234 |
-# Set and exported on request using python_export(). |
235 |
-# Valid only for CPython. Requires a proper build-time dependency |
236 |
-# on the Python implementation and on pkg-config. |
237 |
-# |
238 |
-# Example value: |
239 |
-# @CODE |
240 |
-# -I/usr/include/python2.7 |
241 |
-# @CODE |
242 |
- |
243 |
-# @ECLASS-VARIABLE: PYTHON_LIBS |
244 |
-# @DEFAULT_UNSET |
245 |
-# @DESCRIPTION: |
246 |
-# Proper C compiler flags for linking against Python. Obtained from |
247 |
-# pkg-config or python-config. |
248 |
-# |
249 |
-# Set and exported on request using python_export(). |
250 |
-# Valid only for CPython. Requires a proper build-time dependency |
251 |
-# on the Python implementation and on pkg-config. |
252 |
-# |
253 |
-# Example value: |
254 |
-# @CODE |
255 |
-# -lpython2.7 |
256 |
-# @CODE |
257 |
- |
258 |
-# @ECLASS-VARIABLE: PYTHON_CONFIG |
259 |
-# @DEFAULT_UNSET |
260 |
-# @DESCRIPTION: |
261 |
-# Path to the python-config executable. |
262 |
-# |
263 |
-# Set and exported on request using python_export(). |
264 |
-# Valid only for CPython. Requires a proper build-time dependency |
265 |
-# on the Python implementation and on pkg-config. |
266 |
-# |
267 |
-# Example value: |
268 |
-# @CODE |
269 |
-# /usr/bin/python2.7-config |
270 |
-# @CODE |
271 |
- |
272 |
-# @ECLASS-VARIABLE: PYTHON_PKG_DEP |
273 |
-# @DEFAULT_UNSET |
274 |
-# @DESCRIPTION: |
275 |
-# The complete dependency on a particular Python package as a string. |
276 |
-# |
277 |
-# Set and exported on request using python_export(). |
278 |
-# |
279 |
-# Example value: |
280 |
-# @CODE |
281 |
-# dev-lang/python:2.7[xml] |
282 |
-# @CODE |
283 |
- |
284 |
-# @ECLASS-VARIABLE: PYTHON_SCRIPTDIR |
285 |
-# @DEFAULT_UNSET |
286 |
-# @DESCRIPTION: |
287 |
-# The location where Python scripts must be installed for current impl. |
288 |
-# |
289 |
-# Set and exported on request using python_export(). |
290 |
-# |
291 |
-# Example value: |
292 |
-# @CODE |
293 |
-# /usr/lib/python-exec/python2.7 |
294 |
-# @CODE |
295 |
- |
296 |
-# @FUNCTION: python_export |
297 |
+# @FUNCTION: _python_export |
298 |
# @USAGE: [<impl>] <variables>... |
299 |
+# @INTERNAL |
300 |
# @DESCRIPTION: |
301 |
# Set and export the Python implementation-relevant variables passed |
302 |
# as parameters. |
303 |
@@ -349,7 +242,7 @@ _python_impl_matches() { |
304 |
# The variables which can be exported are: PYTHON, EPYTHON, |
305 |
# PYTHON_SITEDIR. They are described more completely in the eclass |
306 |
# variable documentation. |
307 |
-python_export() { |
308 |
+_python_export() { |
309 |
debug-print-function ${FUNCNAME} "${@}" |
310 |
|
311 |
local impl var |
312 |
@@ -366,7 +259,7 @@ python_export() { |
313 |
*) |
314 |
impl=${EPYTHON} |
315 |
if [[ -z ${impl} ]]; then |
316 |
- die "python_export called without a python implementation and EPYTHON is unset" |
317 |
+ die "_python_export called without a python implementation and EPYTHON is unset" |
318 |
fi |
319 |
;; |
320 |
esac |
321 |
@@ -494,7 +387,7 @@ python_export() { |
322 |
debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}" |
323 |
;; |
324 |
*) |
325 |
- die "python_export: unknown variable ${var}" |
326 |
+ die "_python_export: unknown variable ${var}" |
327 |
esac |
328 |
done |
329 |
} |
330 |
@@ -505,13 +398,10 @@ python_export() { |
331 |
# Obtain and print the 'site-packages' path for the given |
332 |
# implementation. If no implementation is provided, ${EPYTHON} will |
333 |
# be used. |
334 |
-# |
335 |
-# If you just need to have PYTHON_SITEDIR set (and exported), then it is |
336 |
-# better to use python_export() directly instead. |
337 |
python_get_sitedir() { |
338 |
debug-print-function ${FUNCNAME} "${@}" |
339 |
|
340 |
- python_export "${@}" PYTHON_SITEDIR |
341 |
+ _python_export "${@}" PYTHON_SITEDIR |
342 |
echo "${PYTHON_SITEDIR}" |
343 |
} |
344 |
|
345 |
@@ -520,13 +410,10 @@ python_get_sitedir() { |
346 |
# @DESCRIPTION: |
347 |
# Obtain and print the include path for the given implementation. If no |
348 |
# implementation is provided, ${EPYTHON} will be used. |
349 |
-# |
350 |
-# If you just need to have PYTHON_INCLUDEDIR set (and exported), then it |
351 |
-# is better to use python_export() directly instead. |
352 |
python_get_includedir() { |
353 |
debug-print-function ${FUNCNAME} "${@}" |
354 |
|
355 |
- python_export "${@}" PYTHON_INCLUDEDIR |
356 |
+ _python_export "${@}" PYTHON_INCLUDEDIR |
357 |
echo "${PYTHON_INCLUDEDIR}" |
358 |
} |
359 |
|
360 |
@@ -541,7 +428,7 @@ python_get_includedir() { |
361 |
python_get_library_path() { |
362 |
debug-print-function ${FUNCNAME} "${@}" |
363 |
|
364 |
- python_export "${@}" PYTHON_LIBPATH |
365 |
+ _python_export "${@}" PYTHON_LIBPATH |
366 |
echo "${PYTHON_LIBPATH}" |
367 |
} |
368 |
|
369 |
@@ -558,7 +445,7 @@ python_get_library_path() { |
370 |
python_get_CFLAGS() { |
371 |
debug-print-function ${FUNCNAME} "${@}" |
372 |
|
373 |
- python_export "${@}" PYTHON_CFLAGS |
374 |
+ _python_export "${@}" PYTHON_CFLAGS |
375 |
echo "${PYTHON_CFLAGS}" |
376 |
} |
377 |
|
378 |
@@ -575,7 +462,7 @@ python_get_CFLAGS() { |
379 |
python_get_LIBS() { |
380 |
debug-print-function ${FUNCNAME} "${@}" |
381 |
|
382 |
- python_export "${@}" PYTHON_LIBS |
383 |
+ _python_export "${@}" PYTHON_LIBS |
384 |
echo "${PYTHON_LIBS}" |
385 |
} |
386 |
|
387 |
@@ -592,7 +479,7 @@ python_get_LIBS() { |
388 |
python_get_PYTHON_CONFIG() { |
389 |
debug-print-function ${FUNCNAME} "${@}" |
390 |
|
391 |
- python_export "${@}" PYTHON_CONFIG |
392 |
+ _python_export "${@}" PYTHON_CONFIG |
393 |
echo "${PYTHON_CONFIG}" |
394 |
} |
395 |
|
396 |
@@ -605,7 +492,7 @@ python_get_PYTHON_CONFIG() { |
397 |
python_get_scriptdir() { |
398 |
debug-print-function ${FUNCNAME} "${@}" |
399 |
|
400 |
- python_export "${@}" PYTHON_SCRIPTDIR |
401 |
+ _python_export "${@}" PYTHON_SCRIPTDIR |
402 |
echo "${PYTHON_SCRIPTDIR}" |
403 |
} |
404 |
|
405 |
@@ -670,7 +557,7 @@ python_optimize() { |
406 |
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' |
407 |
|
408 |
local PYTHON=${PYTHON} |
409 |
- [[ ${PYTHON} ]] || python_export PYTHON |
410 |
+ [[ ${PYTHON} ]] || _python_export PYTHON |
411 |
|
412 |
# default to sys.path |
413 |
if [[ ${#} -eq 0 ]]; then |
414 |
@@ -774,7 +661,7 @@ python_newexe() { |
415 |
local newfn=${2} |
416 |
|
417 |
local PYTHON_SCRIPTDIR d |
418 |
- python_export PYTHON_SCRIPTDIR |
419 |
+ _python_export PYTHON_SCRIPTDIR |
420 |
d=${PYTHON_SCRIPTDIR#${EPREFIX}} |
421 |
|
422 |
( |
423 |
@@ -902,7 +789,7 @@ python_domodule() { |
424 |
else |
425 |
# relative to site-packages |
426 |
local PYTHON_SITEDIR=${PYTHON_SITEDIR} |
427 |
- [[ ${PYTHON_SITEDIR} ]] || python_export PYTHON_SITEDIR |
428 |
+ [[ ${PYTHON_SITEDIR} ]] || _python_export PYTHON_SITEDIR |
429 |
|
430 |
d=${PYTHON_SITEDIR#${EPREFIX}}/${python_moduleroot//.//} |
431 |
fi |
432 |
@@ -935,7 +822,7 @@ python_doheader() { |
433 |
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' |
434 |
|
435 |
local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR} |
436 |
- [[ ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR |
437 |
+ [[ ${PYTHON_INCLUDEDIR} ]] || _python_export PYTHON_INCLUDEDIR |
438 |
|
439 |
d=${PYTHON_INCLUDEDIR#${EPREFIX}} |
440 |
|
441 |
@@ -979,7 +866,7 @@ _python_wrapper_setup() { |
442 |
rm -f "${workdir}"/pkgconfig/python{,2,3}.pc || die |
443 |
|
444 |
local EPYTHON PYTHON |
445 |
- python_export "${impl}" EPYTHON PYTHON |
446 |
+ _python_export "${impl}" EPYTHON PYTHON |
447 |
|
448 |
local pyver pyother |
449 |
if python_is_python3; then |
450 |
@@ -1085,7 +972,7 @@ _python_is_installed() { |
451 |
esac |
452 |
|
453 |
local PYTHON_PKG_DEP |
454 |
- python_export "${impl}" PYTHON_PKG_DEP |
455 |
+ _python_export "${impl}" PYTHON_PKG_DEP |
456 |
has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}" |
457 |
} |
458 |
|
459 |
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh |
460 |
index 64490cb0d24a..c5e618256519 100755 |
461 |
--- a/eclass/tests/python-utils-r2.sh |
462 |
+++ b/eclass/tests/python-utils-r2.sh |
463 |
@@ -13,7 +13,7 @@ test_var() { |
464 |
tbegin "${var} for ${impl}" |
465 |
|
466 |
local ${var} |
467 |
- python_export ${impl} PYTHON ${var} |
468 |
+ _python_export ${impl} PYTHON ${var} |
469 |
[[ ${!var} == ${expect} ]] || eerror "(${impl}: ${var}: ${!var} != ${expect}" |
470 |
|
471 |
tend ${?} |
472 |
-- |
473 |
2.25.1 |