mgorny      15/01/13 21:34:55

  Modified:             ChangeLog distutils-r1.eclass
  Log:
  Support restricting implementations for *_all() phases.

Revision  Changes    Path
1.1509               eclass/ChangeLog

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1509&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1509&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1508&r2=1.1509

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1508
retrieving revision 1.1509
diff -u -r1.1508 -r1.1509
--- ChangeLog   13 Jan 2015 21:34:22 -0000      1.1508
+++ ChangeLog   13 Jan 2015 21:34:55 -0000      1.1509
@@ -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 <mgo...@gentoo.org> distutils-r1.eclass:
+  Support restricting implementations for *_all() phases.
 
   13 Jan 2015; Michał Górny <mgo...@gentoo.org> python-r1.eclass:
   Support restricting accepted implementation list for python_setup.



1.109                eclass/distutils-r1.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.109&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.109&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?r1=1.108&r2=1.109

Index: distutils-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -r1.108 -r1.109
--- distutils-r1.eclass 28 Dec 2014 10:56:55 -0000      1.108
+++ distutils-r1.eclass 13 Jan 2015 21:34:55 -0000      1.109
@@ -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 @@
 # '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 @@
 # @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
+               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
 
-               multibuild_for_best_variant _python_multibuild_wrapper \
-                       distutils-r1_run_phase "${@}"
-       else
-               # semi-hack, be careful.
-               _distutils-r1_run_foreach_impl "${@}"
+               local PYTHON_COMPAT=( "${best_impl}" )
        fi
+
+       _distutils-r1_run_foreach_impl "${@}"
 }
 
 # @FUNCTION: _distutils-r1_run_foreach_impl




Reply via email to