diff options
author | 2015-01-13 21:34:55 +0000 | |
---|---|---|
committer | 2015-01-13 21:34:55 +0000 | |
commit | 7ef1d51776d2aa74097d9cbd8ef4c490a59fe60f (patch) | |
tree | 7f47616ea75ae85f4726906af40904d38844d36d | |
parent | fix distfile name (diff) | |
download | historical-7ef1d51776d2aa74097d9cbd8ef4c490a59fe60f.tar.gz historical-7ef1d51776d2aa74097d9cbd8ef4c490a59fe60f.tar.bz2 historical-7ef1d51776d2aa74097d9cbd8ef4c490a59fe60f.zip |
Support restricting implementations for *_all() phases.
-rw-r--r-- | eclass/ChangeLog | 5 | ||||
-rw-r--r-- | eclass/distutils-r1.eclass | 57 |
2 files changed, 48 insertions, 14 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 15e5a93b77e1..fc330c456ff5 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for eclass directory # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1508 2015/01/13 21:34:22 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1509 2015/01/13 21:34:55 mgorny Exp $ + + 13 Jan 2015; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass: + Support restricting implementations for *_all() phases. 13 Jan 2015; Michał Górny <mgorny@gentoo.org> python-r1.eclass: Support restricting accepted implementation list for python_setup. diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index da5c6871af91..3c58c12c9732 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -1,6 +1,6 @@ -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.108 2014/12/28 10:56:55 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.109 2015/01/13 21:34:55 mgorny Exp $ # @ECLASS: distutils-r1 # @MAINTAINER: @@ -181,6 +181,31 @@ fi # 'build --build-base ${BUILD_DIR}' to enforce keeping & using built # files in the specific root. +# @ECLASS-VARIABLE: DISTUTILS_ALL_SUBPHASE_IMPLS +# @DEFAULT_UNSET +# @DESCRIPTION: +# An array of patterns specifying which implementations can be used +# for *_all() sub-phase functions. If undefined, defaults to '*' +# (allowing any implementation). If multiple values are specified, +# implementations matching any of the patterns will be accepted. +# +# If the restriction needs to apply conditionally to a USE flag, +# the variable should be set conditionally as well (e.g. in an early +# phase function or other convenient location). +# +# Please remember to add a matching || block to REQUIRED_USE, +# to ensure that at least one implementation matching the patterns will +# be enabled. +# +# Example: +# @CODE +# REQUIRED_USE="doc? ( || ( $(python_gen_useflags 'python2*') ) )" +# +# pkg_setup() { +# use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' ) +# } +# @CODE + # @ECLASS-VARIABLE: mydistutilsargs # @DEFAULT_UNSET # @DESCRIPTION: @@ -624,24 +649,30 @@ distutils-r1_run_phase() { # @USAGE: [<argv>...] # @INTERNAL # @DESCRIPTION: -# Run the given command, restoring the best-implementation state. +# Run the given command, restoring the state for a most preferred Python +# implementation matching DISTUTILS_ALL_SUBPHASE_IMPLS. # # If in-source build is used, the command will be run in the copy -# of sources made for the best Python interpreter. +# of sources made for the selected Python interpreter. _distutils-r1_run_common_phase() { local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR} if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then - local _DISTUTILS_INITIAL_CWD=${PWD} - local MULTIBUILD_VARIANTS - _python_obtain_impls - - multibuild_for_best_variant _python_multibuild_wrapper \ - distutils-r1_run_phase "${@}" - else - # semi-hack, be careful. - _distutils-r1_run_foreach_impl "${@}" + local best_impl patterns=( "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]-*}" ) + _distutils_try_impl() { + local pattern + for pattern in "${patterns[@]}"; do + if [[ ${EPYTHON} == ${pattern} ]]; then + best_impl=${MULTIBUILD_VARIANT} + fi + done + } + python_foreach_impl _distutils_try_impl + + local PYTHON_COMPAT=( "${best_impl}" ) fi + + _distutils-r1_run_foreach_impl "${@}" } # @FUNCTION: _distutils-r1_run_foreach_impl |