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

Replies