Lines 34-40
fi
Link Here
|
34 |
|
34 |
|
35 |
if [[ ! ${_PYTHON_UTILS_R1} ]]; then |
35 |
if [[ ! ${_PYTHON_UTILS_R1} ]]; then |
36 |
|
36 |
|
37 |
inherit multilib |
37 |
inherit multilib toolchain-funcs |
38 |
|
38 |
|
39 |
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS |
39 |
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS |
40 |
# @INTERNAL |
40 |
# @INTERNAL |
Lines 136-141
_python_impl_supported() {
Link Here
|
136 |
# /usr/lib64/libpython2.6.so |
136 |
# /usr/lib64/libpython2.6.so |
137 |
# @CODE |
137 |
# @CODE |
138 |
|
138 |
|
|
|
139 |
# @ECLASS-VARIABLE: PYTHON_CFLAGS |
140 |
# @DESCRIPTION: |
141 |
# Proper C compiler flags for building against Python. Obtained from |
142 |
# pkg-config or python-config. |
143 |
# |
144 |
# Set and exported on request using python_export(). |
145 |
# Valid only for CPython. Requires a proper build-time dependency |
146 |
# on the Python implementation and on pkg-config. |
147 |
# |
148 |
# Example value: |
149 |
# @CODE |
150 |
# -I/usr/include/python2.7 |
151 |
# @CODE |
152 |
|
153 |
# @ECLASS-VARIABLE: PYTHON_LIBS |
154 |
# @DESCRIPTION: |
155 |
# Proper C compiler flags for linking against Python. Obtained from |
156 |
# pkg-config or python-config. |
157 |
# |
158 |
# Set and exported on request using python_export(). |
159 |
# Valid only for CPython. Requires a proper build-time dependency |
160 |
# on the Python implementation and on pkg-config. |
161 |
# |
162 |
# Example value: |
163 |
# @CODE |
164 |
# -lpython2.7 |
165 |
# @CODE |
166 |
|
139 |
# @ECLASS-VARIABLE: PYTHON_PKG_DEP |
167 |
# @ECLASS-VARIABLE: PYTHON_PKG_DEP |
140 |
# @DESCRIPTION: |
168 |
# @DESCRIPTION: |
141 |
# The complete dependency on a particular Python package as a string. |
169 |
# The complete dependency on a particular Python package as a string. |
Lines 238-244
python_export() {
Link Here
|
238 |
libname=lib${impl} |
266 |
libname=lib${impl} |
239 |
;; |
267 |
;; |
240 |
*) |
268 |
*) |
241 |
die "${EPYTHON} lacks a dynamic library" |
269 |
die "${impl} lacks a dynamic library" |
242 |
;; |
270 |
;; |
243 |
esac |
271 |
esac |
244 |
|
272 |
|
Lines 247-252
python_export() {
Link Here
|
247 |
export PYTHON_LIBPATH=${path}/${libname}$(get_libname) |
275 |
export PYTHON_LIBPATH=${path}/${libname}$(get_libname) |
248 |
debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}" |
276 |
debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}" |
249 |
;; |
277 |
;; |
|
|
278 |
PYTHON_CFLAGS) |
279 |
local val |
280 |
|
281 |
case "${impl}" in |
282 |
python2.5|python2.6) |
283 |
# old versions support python-config only |
284 |
val=$("${impl}-config" --includes) |
285 |
;; |
286 |
python*) |
287 |
# python-2.7, python-3.2, etc. |
288 |
val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) |
289 |
;; |
290 |
*) |
291 |
die "${impl}: obtaining ${var} not supported" |
292 |
;; |
293 |
esac |
294 |
|
295 |
export PYTHON_CFLAGS=${val} |
296 |
debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}" |
297 |
;; |
298 |
PYTHON_LIBS) |
299 |
local val |
300 |
|
301 |
case "${impl}" in |
302 |
python2.5|python2.6) |
303 |
# old versions support python-config only |
304 |
val=$("${impl}-config" --libs) |
305 |
;; |
306 |
python*) |
307 |
# python-2.7, python-3.2, etc. |
308 |
val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) |
309 |
;; |
310 |
*) |
311 |
die "${impl}: obtaining ${var} not supported" |
312 |
;; |
313 |
esac |
314 |
|
315 |
export PYTHON_LIBS=${val} |
316 |
debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}" |
317 |
;; |
250 |
PYTHON_PKG_DEP) |
318 |
PYTHON_PKG_DEP) |
251 |
local d |
319 |
local d |
252 |
case ${impl} in |
320 |
case ${impl} in |
Lines 353-358
python_get_library_path() {
Link Here
|
353 |
echo "${PYTHON_LIBPATH}" |
421 |
echo "${PYTHON_LIBPATH}" |
354 |
} |
422 |
} |
355 |
|
423 |
|
|
|
424 |
# @FUNCTION: python_get_CFLAGS |
425 |
# @USAGE: [<impl>] |
426 |
# @DESCRIPTION: |
427 |
# Obtain and print the compiler flags for building against Python, |
428 |
# for the given implementation. If no implementation is provided, |
429 |
# ${EPYTHON} will be used. |
430 |
# |
431 |
# Please note that this function can be used with CPython only. |
432 |
# It requires Python and pkg-config installed, and therefore proper |
433 |
# build-time dependencies need be added to the ebuild. |
434 |
python_get_CFLAGS() { |
435 |
debug-print-function ${FUNCNAME} "${@}" |
436 |
|
437 |
python_export "${@}" PYTHON_CFLAGS |
438 |
echo "${PYTHON_CFLAGS}" |
439 |
} |
440 |
|
441 |
# @FUNCTION: python_get_LIBS |
442 |
# @USAGE: [<impl>] |
443 |
# @DESCRIPTION: |
444 |
# Obtain and print the compiler flags for linking against Python, |
445 |
# for the given implementation. If no implementation is provided, |
446 |
# ${EPYTHON} will be used. |
447 |
# |
448 |
# Please note that this function can be used with CPython only. |
449 |
# It requires Python and pkg-config installed, and therefore proper |
450 |
# build-time dependencies need be added to the ebuild. |
451 |
python_get_LIBS() { |
452 |
debug-print-function ${FUNCNAME} "${@}" |
453 |
|
454 |
python_export "${@}" PYTHON_LIBS |
455 |
echo "${PYTHON_LIBS}" |
456 |
} |
457 |
|
356 |
# @FUNCTION: _python_rewrite_shebang |
458 |
# @FUNCTION: _python_rewrite_shebang |
357 |
# @INTERNAL |
459 |
# @INTERNAL |
358 |
# @USAGE: [<EPYTHON>] <path>... |
460 |
# @USAGE: [<EPYTHON>] <path>... |
359 |
- |
|
|