public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH] Introduce PYTHON_INCLUDEDIR and python_get_includedir.
@ 2012-12-24 13:01 Michał Górny
  2012-12-24 16:26 ` [gentoo-python] " Mike Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2012-12-24 13:01 UTC (permalink / raw
  To: gentoo-python; +Cc: python, Michał Górny

---
 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-24 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-24 13:01 [gentoo-python] [PATCH] Introduce PYTHON_INCLUDEDIR and python_get_includedir Michał Górny
2012-12-24 16:26 ` [gentoo-python] " Mike Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox