Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH] Support python_get_library_path().
Date: Sun, 03 Feb 2013 23:57:21
Message-Id: 1359935832-22688-1-git-send-email-mgorny@gentoo.org
1 Needed for dev-python/shiboken.
2 ---
3 gx86/eclass/python-utils-r1.eclass | 43 ++++++++++++++++++++++++++++++++++++++
4 1 file changed, 43 insertions(+)
5
6 diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
7 index b425302..5facf33 100644
8 --- a/gx86/eclass/python-utils-r1.eclass
9 +++ b/gx86/eclass/python-utils-r1.eclass
10 @@ -124,6 +124,18 @@ _python_impl_supported() {
11 # /usr/include/python2.6
12 # @CODE
13
14 +# @ECLASS-VARIABLE: PYTHON_LIBPATH
15 +# @DESCRIPTION:
16 +# The path to Python library.
17 +#
18 +# Set and exported on request using python_export().
19 +# Valid only for CPython.
20 +#
21 +# Example value:
22 +# @CODE
23 +# /usr/lib64/libpython2.6.so
24 +# @CODE
25 +
26 # @ECLASS-VARIABLE: PYTHON_PKG_DEP
27 # @DESCRIPTION:
28 # The complete dependency on a particular Python package as a string.
29 @@ -219,6 +231,22 @@ python_export() {
30 export PYTHON_INCLUDEDIR=${EPREFIX}${dir}
31 debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
32 ;;
33 + PYTHON_LIBPATH)
34 + local libname
35 + case "${impl}" in
36 + python*)
37 + libname=lib${impl}
38 + ;;
39 + *)
40 + die "${EPYTHON} lacks a dynamic library"
41 + ;;
42 + esac
43 +
44 + local path=${EPREFIX}/usr/$(get_libdir)
45 +
46 + export PYTHON_LIBPATH=${path}/${libname}$(get_libname)
47 + debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
48 + ;;
49 PYTHON_PKG_DEP)
50 local d
51 case ${impl} in
52 @@ -310,6 +338,21 @@ python_get_includedir() {
53 echo "${PYTHON_INCLUDEDIR}"
54 }
55
56 +# @FUNCTION: python_get_library_path
57 +# @USAGE: [<impl>]
58 +# @DESCRIPTION:
59 +# Obtain and print the Python library path for the given implementation.
60 +# If no implementation is provided, ${EPYTHON} will be used.
61 +#
62 +# Please note that this function can be used with CPython only. Use
63 +# in another implementation will result in a fatal failure.
64 +python_get_library_path() {
65 + debug-print-function ${FUNCNAME} "${@}"
66 +
67 + python_export "${@}" PYTHON_LIBPATH
68 + echo "${PYTHON_LIBPATH}"
69 +}
70 +
71 # @FUNCTION: _python_rewrite_shebang
72 # @INTERNAL
73 # @USAGE: [<EPYTHON>] <path>...
74 --
75 1.8.1.2

Replies

Subject Author
[gentoo-python] Re: [PATCH] Support python_get_library_path(). Mike Gilbert <floppym@g.o>