diff options
author | Michał Górny <mgorny@gentoo.org> | 2012-12-27 22:56:53 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2012-12-27 22:56:53 +0000 |
commit | c000359b205554f70a77a9c1155776bb162a31e4 (patch) | |
tree | 98bb0029589596d607a47c5b1265658ac1101d6e /eclass/python-utils-r1.eclass | |
parent | Introduce python_gen_usedep() and python_gen_flags() to make writing complex ... (diff) | |
download | gentoo-2-c000359b205554f70a77a9c1155776bb162a31e4.tar.gz gentoo-2-c000359b205554f70a77a9c1155776bb162a31e4.tar.bz2 gentoo-2-c000359b205554f70a77a9c1155776bb162a31e4.zip |
Introduce functions to get the includedir for Python.
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r-- | eclass/python-utils-r1.eclass | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index afa478b19a9e..0359e14268cd 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.9 2012/12/20 23:35:17 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.10 2012/12/27 22:56:53 mgorny Exp $ # @ECLASS: python-utils-r1 # @MAINTAINER: @@ -83,6 +83,17 @@ _PYTHON_ALL_IMPLS=( # /usr/lib64/python2.6/site-packages # @CODE +# @ECLASS-VARIABLE: PYTHON_INCLUDEDIR +# @DESCRIPTION: +# The path to Python include directory. +# +# Set and exported on request using python_export(). +# +# Example value: +# @CODE +# /usr/include/python2.6 +# @CODE + # @ECLASS-VARIABLE: PYTHON_PKG_DEP # @DESCRIPTION: # The complete dependency on a particular Python package as a string. @@ -161,6 +172,23 @@ python_export() { export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}" ;; + PYTHON_INCLUDEDIR) + local dir + case "${impl}" in + python*) + dir=/usr/include/${impl} + ;; + jython*) + dir=/usr/share/${impl}/Include + ;; + pypy*) + dir=/usr/$(get_libdir)/${impl/-c/}/include + ;; + esac + + export PYTHON_INCLUDEDIR=${EPREFIX}${dir} + debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}" + ;; PYTHON_PKG_DEP) local d case ${impl} in @@ -237,6 +265,21 @@ python_get_sitedir() { echo "${PYTHON_SITEDIR}" } +# @FUNCTION: python_get_includedir +# @USAGE: [<impl>] +# @DESCRIPTION: +# Obtain and print the include path for the given implementation. If no +# implementation is provided, ${EPYTHON} will be used. +# +# If you just need to have PYTHON_INCLUDEDIR set (and exported), then it +# is better to use python_export() directly instead. +python_get_includedir() { + debug-print-function ${FUNCNAME} "${@}" + + python_export "${@}" PYTHON_INCLUDEDIR + echo "${PYTHON_INCLUDEDIR}" +} + # @FUNCTION: _python_rewrite_shebang # @INTERNAL # @USAGE: [<EPYTHON>] <path>... |