From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-python+bounces-307-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 607291381F3 for <garchives@archives.gentoo.org>; Mon, 24 Dec 2012 13:01:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A79AD21C0A1; Mon, 24 Dec 2012 13:01:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C918E21C0A1 for <gentoo-python@lists.gentoo.org>; Mon, 24 Dec 2012 13:01:15 +0000 (UTC) Received: from pomiocik.lan (77-253-156-107.adsl.inetia.pl [77.253.156.107]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id B5EB133D80D; Mon, 24 Dec 2012 13:01:13 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> To: gentoo-python@lists.gentoo.org Cc: python@gentoo.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> Subject: [gentoo-python] [PATCH] Introduce PYTHON_INCLUDEDIR and python_get_includedir. Date: Mon, 24 Dec 2012 14:01:16 +0100 Message-Id: <1356354076-5238-1-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 1.8.0.2 Precedence: bulk List-Post: <mailto:gentoo-python@lists.gentoo.org> List-Help: <mailto:gentoo-python+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-python+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-python+subscribe@lists.gentoo.org> List-Id: Discussions centering around the Python ecosystem in Gentoo Linux <gentoo-python.gentoo.org> X-BeenThere: gentoo-python@gentoo.org X-BeenThere: gentoo-python@lists.gentoo.org X-Archives-Salt: 8d9ec0f2-a2c7-4a5f-9f74-dbc41b5f3b3a X-Archives-Hash: 5eeeb05b06e416b3d464f1de00e3020c --- gx86/eclass/python-utils-r1.eclass | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass index afa478b..a5f36e0 100644 --- a/gx86/eclass/python-utils-r1.eclass +++ b/gx86/eclass/python-utils-r1.eclass @@ -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>... -- 1.8.0.2