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 | 0f11d0bc5901053d0ec4f3d7f236b3b8adf384ad (patch) | |
tree | 6c26b422e82f966c9229d881ecef4a1f56ef68e1 | |
parent | Introduce python_gen_usedep() and python_gen_flags() to make writing complex ... (diff) | |
download | historical-0f11d0bc5901053d0ec4f3d7f236b3b8adf384ad.tar.gz historical-0f11d0bc5901053d0ec4f3d7f236b3b8adf384ad.tar.bz2 historical-0f11d0bc5901053d0ec4f3d7f236b3b8adf384ad.zip |
Introduce functions to get the includedir for Python.
-rw-r--r-- | eclass/ChangeLog | 5 | ||||
-rw-r--r-- | eclass/python-utils-r1.eclass | 45 |
2 files changed, 48 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index d9210b5fefa3..478ebbd26ff5 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for eclass directory # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.577 2012/12/27 22:56:21 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.578 2012/12/27 22:56:53 mgorny Exp $ + + 27 Dec 2012; Michał Górny <mgorny@gentoo.org> python-utils-r1.eclass: + Introduce functions to get the includedir for Python. 27 Dec 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass: Introduce python_gen_usedep() and python_gen_flags() to make writing complex 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>... |