[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use _python_impl_matches()
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2017-05-20 8:56:15
Message-ID: 20170520085616.5602-4-mgorny () gentoo ! org
[Download RAW message or body]

Update the missed occurence of pattern matching with the new framework.
---
 eclass/distutils-r1.eclass | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 1376326c9579..6078fb6d52b7 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: distutils-r1.eclass
@@ -191,6 +191,12 @@ fi
 # (allowing any implementation). If multiple values are specified,
 # implementations matching any of the patterns will be accepted.
 #
+# The patterns can be either fnmatch-style patterns (matched via bash
+# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
+# appropriately all enabled Python 2/3 implementations (alike
+# python_is_python3). Remember to escape or quote the fnmatch patterns
+# to prevent accidental shell filename expansion.
+#
 # 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).
@@ -669,12 +675,9 @@ _distutils-r1_run_common_phase() {
 	if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
 		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
+			if _python_impl_matches "${EPYTHON}" "${patterns[@]}"; then
+				best_impl=${MULTIBUILD_VARIANT}
+			fi
 		}
 		python_foreach_impl _distutils_try_impl
 		unset -f _distutils_try_impl
-- 
2.13.0


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic