summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2012-10-29 09:22:13 +0000
committerMichał Górny <mgorny@gentoo.org>2012-10-29 09:22:13 +0000
commitf54f89148c3a98cc98817d13878757c869d7ba73 (patch)
tree59f0d8ff32b25f79d2b631f1900babdcf9fceca3 /eclass/python-r1.eclass
parentbetter config error messages, bug 439800 in addition (diff)
downloadhistorical-f54f89148c3a98cc98817d13878757c869d7ba73.tar.gz
historical-f54f89148c3a98cc98817d13878757c869d7ba73.tar.bz2
historical-f54f89148c3a98cc98817d13878757c869d7ba73.zip
Add support for obtaining Python site-packages directory.
Diffstat (limited to 'eclass/python-r1.eclass')
-rw-r--r--eclass/python-r1.eclass36
1 files changed, 33 insertions, 3 deletions
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index 9ca0791ac8f7..b04e1b778e8b 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-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-r1.eclass,v 1.7 2012/10/27 01:14:38 floppym Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.8 2012/10/29 09:22:13 mgorny Exp $
# @ECLASS: python-r1
# @MAINTAINER:
@@ -36,6 +36,8 @@ case "${EAPI}" in
;;
esac
+inherit multilib
+
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
# @INTERNAL
# @DESCRIPTION:
@@ -198,6 +200,16 @@ _python_set_globals
# python2.6
# @CODE
+# @ECLASS-VARIABLE: PYTHON_SITEDIR
+# @DESCRIPTION:
+# The path to Python site-packages directory.
+#
+# Set and exported on request using python_export().
+#
+# Example value:
+# @CODE
+# @CODE
+
# @FUNCTION: python_export
# @USAGE: [<impl>] <variables>...
# @DESCRIPTION:
@@ -209,8 +221,9 @@ _python_set_globals
# or an EPYTHON one, e.g. python2.7). If no implementation passed,
# the current one will be obtained from ${EPYTHON}.
#
-# The variables which can be exported are: PYTHON, EPYTHON. They are
-# described more completely in the eclass variable documentation.
+# The variables which can be exported are: PYTHON, EPYTHON,
+# PYTHON_SITEDIR. They are described more completely in the eclass
+# variable documentation.
python_export() {
debug-print-function ${FUNCNAME} "${@}"
@@ -247,6 +260,23 @@ python_export() {
export PYTHON=${EPREFIX}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
+ PYTHON_SITEDIR)
+ local dir
+ case "${impl}" in
+ python*)
+ dir=/usr/$(get_libdir)/${impl}
+ ;;
+ jython*)
+ dir=/usr/share/${impl}/Lib
+ ;;
+ pypy*)
+ dir=/usr/$(get_libdir)/${impl/-c/}
+ ;;
+ esac
+
+ export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages
+ debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
+ ;;
*)
die "python_export: unknown variable ${var}"
esac