Gentoo Archives: gentoo-python

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