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