summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/python-r1.eclass48
2 files changed, 51 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 13f4d94df76b..c4081f1626b0 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.474 2012/10/29 09:22:13 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.475 2012/10/29 09:23:58 mgorny Exp $
+
+ 29 Oct 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
+ Add getters for common Python variables.
29 Oct 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
Add support for obtaining Python site-packages directory.
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index b04e1b778e8b..4ce32bd092d9 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.8 2012/10/29 09:22:13 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.9 2012/10/29 09:23:58 mgorny Exp $
# @ECLASS: python-r1
# @MAINTAINER:
@@ -283,6 +283,52 @@ python_export() {
done
}
+# @FUNCTION: python_get_PYTHON
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the path to the Python interpreter for the given
+# implementation. If no implementation is provided, ${EPYTHON} will
+# be used.
+#
+# If you just need to have PYTHON set (and exported), then it is better
+# to use python_export() directly instead.
+python_get_PYTHON() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ python_export "${@}" PYTHON
+ echo "${PYTHON}"
+}
+
+# @FUNCTION: python_get_EPYTHON
+# @USAGE: <impl>
+# @DESCRIPTION:
+# Obtain and print the EPYTHON value for the given implementation.
+#
+# If you just need to have EPYTHON set (and exported), then it is better
+# to use python_export() directly instead.
+python_get_EPYTHON() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ python_export "${@}" EPYTHON
+ echo "${EPYTHON}"
+}
+
+# @FUNCTION: python_get_sitedir
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the 'site-packages' path for the given
+# implementation. If no implementation is provided, ${EPYTHON} will
+# be used.
+#
+# If you just need to have PYTHON_SITEDIR set (and exported), then it is
+# better to use python_export() directly instead.
+python_get_sitedir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ python_export "${@}" PYTHON_SITEDIR
+ echo "${PYTHON_SITEDIR}"
+}
+
# @FUNCTION: python_copy_sources
# @DESCRIPTION:
# Create a single copy of the package sources (${S}) for each enabled