public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-python@lists.gentoo.org
Cc: python@gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-python] [PATCH] Support python_get_library_path().
Date: Mon,  4 Feb 2013 00:57:12 +0100	[thread overview]
Message-ID: <1359935832-22688-1-git-send-email-mgorny@gentoo.org> (raw)

Needed for dev-python/shiboken.
---
 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 b425302..5facf33 100644
--- a/gx86/eclass/python-utils-r1.eclass
+++ b/gx86/eclass/python-utils-r1.eclass
@@ -124,6 +124,18 @@ _python_impl_supported() {
 # /usr/include/python2.6
 # @CODE
 
+# @ECLASS-VARIABLE: PYTHON_LIBPATH
+# @DESCRIPTION:
+# The path to Python library.
+#
+# Set and exported on request using python_export().
+# Valid only for CPython.
+#
+# Example value:
+# @CODE
+# /usr/lib64/libpython2.6.so
+# @CODE
+
 # @ECLASS-VARIABLE: PYTHON_PKG_DEP
 # @DESCRIPTION:
 # The complete dependency on a particular Python package as a string.
@@ -219,6 +231,22 @@ python_export() {
 				export PYTHON_INCLUDEDIR=${EPREFIX}${dir}
 				debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
 				;;
+			PYTHON_LIBPATH)
+				local libname
+				case "${impl}" in
+					python*)
+						libname=lib${impl}
+						;;
+					*)
+						die "${EPYTHON} lacks a dynamic library"
+						;;
+				esac
+
+				local path=${EPREFIX}/usr/$(get_libdir)
+
+				export PYTHON_LIBPATH=${path}/${libname}$(get_libname)
+				debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
+				;;
 			PYTHON_PKG_DEP)
 				local d
 				case ${impl} in
@@ -310,6 +338,21 @@ python_get_includedir() {
 	echo "${PYTHON_INCLUDEDIR}"
 }
 
+# @FUNCTION: python_get_library_path
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the Python library path for the given implementation.
+# If no implementation is provided, ${EPYTHON} will be used.
+#
+# Please note that this function can be used with CPython only. Use
+# in another implementation will result in a fatal failure.
+python_get_library_path() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	python_export "${@}" PYTHON_LIBPATH
+	echo "${PYTHON_LIBPATH}"
+}
+
 # @FUNCTION: _python_rewrite_shebang
 # @INTERNAL
 # @USAGE: [<EPYTHON>] <path>...
-- 
1.8.1.2



             reply	other threads:[~2013-02-03 23:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-03 23:57 Michał Górny [this message]
2013-02-04  1:14 ` [gentoo-python] Re: [PATCH] Support python_get_library_path() Mike Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359935832-22688-1-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-python@lists.gentoo.org \
    --cc=python@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox