summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-02-04 13:53:54 +0000
committerMichał Górny <mgorny@gentoo.org>2013-02-04 13:53:54 +0000
commit8ff8942b9cc1cd0f9ff2493ee4f04ef7f56ad8e6 (patch)
tree9e059f3ab84d673ecf198cb9803eb64da60a50fe /eclass
parentIntroduce python_newscript(), to install scripts with renaming. Requested in ... (diff)
downloadhistorical-8ff8942b9cc1cd0f9ff2493ee4f04ef7f56ad8e6.tar.gz
historical-8ff8942b9cc1cd0f9ff2493ee4f04ef7f56ad8e6.tar.bz2
historical-8ff8942b9cc1cd0f9ff2493ee4f04ef7f56ad8e6.zip
Introduce python_get_library_path() to obtain the path to the Python library. Required by dev-python/shiboken.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/python-utils-r1.eclass45
2 files changed, 49 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index fcaa6a891bb8..e33a9e0b1c30 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.659 2013/02/04 13:52:09 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.660 2013/02/04 13:53:54 mgorny Exp $
+
+ 04 Feb 2013; Michał Górny <mgorny@gentoo.org> python-utils-r1.eclass:
+ Introduce python_get_library_path() to obtain the path to the Python library.
+ Required by dev-python/shiboken.
04 Feb 2013; Michał Górny <mgorny@gentoo.org> python-utils-r1.eclass:
Introduce python_newscript(), to install scripts with renaming. Requested in
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 986f7b1c92e1..c12c3c1f8b36 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 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.17 2013/02/04 13:52:09 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.18 2013/02/04 13:53:54 mgorny Exp $
# @ECLASS: python-utils-r1
# @MAINTAINER:
@@ -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>...