From 509bd2b7527c2af7396a9f0a52213af2d3423160 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Mon, 29 Oct 2012 09:23:58 +0000 Subject: Add getters for common Python variables. --- eclass/python-r1.eclass | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'eclass/python-r1.eclass') 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: [] +# @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: +# @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: [] +# @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 -- cgit v1.2.3-65-gdbad