diff options
author | Michał Górny <mgorny@gentoo.org> | 2012-10-25 16:44:54 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2012-10-25 16:44:54 +0000 |
commit | 87c4bcb0fa4bd64bc56dfd347f0e58fc6c238cf5 (patch) | |
tree | 711a3f13b5920239c6be3fc973371385a1d581b1 /eclass | |
parent | Version bump. Remove versions that are affected by the worldwide ext4 corrupt... (diff) | |
download | gentoo-2-87c4bcb0fa4bd64bc56dfd347f0e58fc6c238cf5.tar.gz gentoo-2-87c4bcb0fa4bd64bc56dfd347f0e58fc6c238cf5.tar.bz2 gentoo-2-87c4bcb0fa4bd64bc56dfd347f0e58fc6c238cf5.zip |
Introduce python_export() to set Python-relevant variables, and document them better.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 7 | ||||
-rw-r--r-- | eclass/distutils-r1.eclass | 4 | ||||
-rw-r--r-- | eclass/python-r1.eclass | 98 |
3 files changed, 90 insertions, 19 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index dd22500872e0..6f591dfc532d 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for eclass directory # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.465 2012/10/25 12:48:58 scarabeus Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.466 2012/10/25 16:44:54 mgorny Exp $ + + 25 Oct 2012; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass, + python-r1.eclass: + Introduce python_export() to set Python-relevant variables, and document them + better. 25 Oct 2012; Tomáš Chvátal <scarabeus@gentoo.org> cmake-utils.eclass: Include fix for bug#439268. diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 093f79c3cb5e..94b1d608ff20 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-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/distutils-r1.eclass,v 1.5 2012/10/23 20:58:05 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.6 2012/10/25 16:44:54 mgorny Exp $ # @ECLASS: distutils-r1 # @MAINTAINER: @@ -256,7 +256,7 @@ distutils-r1_python_install_all() { local impl EPYTHON PYTHON for impl in "${PYTHON_COMPAT[@]}"; do if use "python_targets_${impl}"; then - _python_set_PYTHON "${impl}" + python_export "${impl}" EPYTHON break fi done diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass index 29a8c3553e20..e14ad712f04b 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.3 2012/10/23 20:58:05 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.4 2012/10/25 16:44:54 mgorny Exp $ # @ECLASS: python-r1 # @MAINTAINER: @@ -154,32 +154,98 @@ _python_set_globals() { } _python_set_globals -# @FUNCTION: _python_set_PYTHON -# @USAGE: <impl> -# @INTERNAL +# @ECLASS-VARIABLE: BUILD_DIR +# @DESCRIPTION: +# The current build directory. In global scope, it is supposed to +# contain an initial build directory; if unset, it defaults to ${S}. +# +# In functions run by python_foreach_impl(), the BUILD_DIR is locally +# set to an implementation-specific build directory. That path is +# created through appending a hyphen and the implementation name +# to the final component of the initial BUILD_DIR. +# +# Example value: +# @CODE +# ${WORKDIR}/foo-1.3-python2_6 +# @CODE + +# @ECLASS-VARIABLE: PYTHON +# @DESCRIPTION: +# The absolute path to the current Python interpreter. +# +# Set and exported only in commands run by python_foreach_impl(). +# +# Example value: +# @CODE +# /usr/bin/python2.6 +# @CODE + +# @ECLASS-VARIABLE: EPYTHON # @DESCRIPTION: -# Get the Python executable name for the given implementation and set it -# as ${PYTHON} & ${EPYTHON}. Please note that EPYTHON will contain -# the 'basename' while PYTHON will contain the full path. -_python_set_PYTHON() { +# The executable name of the current Python interpreter. +# +# This variable is used consistently with python.eclass. +# +# Set and exported only in commands run by python_foreach_impl(). +# +# Example value: +# @CODE +# python2.6 +# @CODE + +# @FUNCTION: python_export +# @USAGE: [<impl>] <variables>... +# @DESCRIPTION: +# Set and export the Python implementation-relevant variables passed +# as parameters. +# +# The optional first parameter may specify the requested Python +# implementation (either as PYTHON_TARGETS value, e.g. python2_7, +# 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. +python_export() { debug-print-function ${FUNCNAME} "${@}" - local impl=${1/_/.} + local impl var - case "${impl}" in + case "${1}" in python*|jython*) - EPYTHON=${impl} + impl=${1/_/.} + shift + ;; + pypy-c*) + impl=${1} + shift ;; pypy*) - EPYTHON=pypy-c${impl#pypy} + local v=${1#pypy} + impl=pypy-c${v/_/.} + shift ;; *) - die "Invalid argument to _python_set_PYTHON: ${1}" + impl=${EPYTHON} + [[ ${impl} ]] || die "python_export: no impl nor EPYTHON" ;; esac - PYTHON=${EPREFIX}/usr/bin/${EPYTHON} + debug-print "${FUNCNAME}: implementation: ${impl}" - debug-print "${FUNCNAME}: ${impl} -> ${PYTHON}" + for var; do + case "${var}" in + EPYTHON) + export EPYTHON=${impl} + debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}" + ;; + PYTHON) + export PYTHON=${EPREFIX}/usr/bin/${impl} + debug-print "${FUNCNAME}: PYTHON = ${PYTHON}" + ;; + *) + die "python_export: unknown variable ${var}" + esac + done } # @ECLASS-VARIABLE: BUILD_DIR @@ -275,7 +341,7 @@ python_foreach_impl() { if has "${impl}" "${PYTHON_COMPAT[@]}" && use "python_targets_${impl}" then local EPYTHON PYTHON - _python_set_PYTHON "${impl}" + python_export "${impl}" EPYTHON PYTHON local BUILD_DIR=${bdir%%/}-${impl} export EPYTHON PYTHON |