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] Introduce PYTHON_INCLUDEDIR and python_get_includedir.
Date: Mon, 24 Dec 2012 16:26:34
Message-Id: CAJ0EP40z=CLn4YVo_vtFv8y85Sqjy1AQThydvgsZF=zTbninnQ@mail.gmail.com
In Reply to: [gentoo-python] [PATCH] Introduce PYTHON_INCLUDEDIR and python_get_includedir. by "Michał Górny"
1 On Mon, Dec 24, 2012 at 8:01 AM, Michał Górny <mgorny@g.o> wrote:
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 afa478b..a5f36e0 100644
8 > --- a/gx86/eclass/python-utils-r1.eclass
9 > +++ b/gx86/eclass/python-utils-r1.eclass
10 > @@ -83,6 +83,17 @@ _PYTHON_ALL_IMPLS=(
11 > # /usr/lib64/python2.6/site-packages
12 > # @CODE
13 >
14 > +# @ECLASS-VARIABLE: PYTHON_INCLUDEDIR
15 > +# @DESCRIPTION:
16 > +# The path to Python include directory.
17 > +#
18 > +# Set and exported on request using python_export().
19 > +#
20 > +# Example value:
21 > +# @CODE
22 > +# /usr/include/python2.6
23 > +# @CODE
24 > +
25 > # @ECLASS-VARIABLE: PYTHON_PKG_DEP
26 > # @DESCRIPTION:
27 > # The complete dependency on a particular Python package as a string.
28 > @@ -161,6 +172,23 @@ python_export() {
29 > export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages
30 > debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
31 > ;;
32 > + PYTHON_INCLUDEDIR)
33 > + local dir
34 > + case "${impl}" in
35 > + python*)
36 > + dir=/usr/include/${impl}
37 > + ;;
38 > + jython*)
39 > + dir=/usr/share/${impl}/Include
40 > + ;;
41 > + pypy*)
42 > + dir=/usr/$(get_libdir)/${impl/-c/}/include
43 > + ;;
44 > + esac
45 > +
46 > + export PYTHON_INCLUDEDIR=${EPREFIX}${dir}
47 > + debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
48 > + ;;
49 > PYTHON_PKG_DEP)
50 > local d
51 > case ${impl} in
52 > @@ -237,6 +265,21 @@ python_get_sitedir() {
53 > echo "${PYTHON_SITEDIR}"
54 > }
55 >
56 > +# @FUNCTION: python_get_includedir
57 > +# @USAGE: [<impl>]
58 > +# @DESCRIPTION:
59 > +# Obtain and print the include path for the given implementation. If no
60 > +# implementation is provided, ${EPYTHON} will be used.
61 > +#
62 > +# If you just need to have PYTHON_INCLUDEDIR set (and exported), then it
63 > +# is better to use python_export() directly instead.
64 > +python_get_includedir() {
65 > + debug-print-function ${FUNCNAME} "${@}"
66 > +
67 > + python_export "${@}" PYTHON_INCLUDEDIR
68 > + echo "${PYTHON_INCLUDEDIR}"
69 > +}
70 > +
71 > # @FUNCTION: _python_rewrite_shebang
72 > # @INTERNAL
73 > # @USAGE: [<EPYTHON>] <path>...
74 > --
75 > 1.8.0.2
76 >
77
78 Ok