Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use _python_impl_matches()
Date: Sat, 20 May 2017 08:58:09
Message-Id: 20170520085616.5602-4-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] python-r1 suite: minor fixes by "Michał Górny"
1 Update the missed occurence of pattern matching with the new framework.
2 ---
3 eclass/distutils-r1.eclass | 17 ++++++++++-------
4 1 file changed, 10 insertions(+), 7 deletions(-)
5
6 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
7 index 1376326c9579..6078fb6d52b7 100644
8 --- a/eclass/distutils-r1.eclass
9 +++ b/eclass/distutils-r1.eclass
10 @@ -1,4 +1,4 @@
11 -# Copyright 1999-2016 Gentoo Foundation
12 +# Copyright 1999-2017 Gentoo Foundation
13 # Distributed under the terms of the GNU General Public License v2
14
15 # @ECLASS: distutils-r1.eclass
16 @@ -191,6 +191,12 @@ fi
17 # (allowing any implementation). If multiple values are specified,
18 # implementations matching any of the patterns will be accepted.
19 #
20 +# The patterns can be either fnmatch-style patterns (matched via bash
21 +# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
22 +# appropriately all enabled Python 2/3 implementations (alike
23 +# python_is_python3). Remember to escape or quote the fnmatch patterns
24 +# to prevent accidental shell filename expansion.
25 +#
26 # If the restriction needs to apply conditionally to a USE flag,
27 # the variable should be set conditionally as well (e.g. in an early
28 # phase function or other convenient location).
29 @@ -669,12 +675,9 @@ _distutils-r1_run_common_phase() {
30 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
31 local best_impl patterns=( "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]-*}" )
32 _distutils_try_impl() {
33 - local pattern
34 - for pattern in "${patterns[@]}"; do
35 - if [[ ${EPYTHON} == ${pattern} ]]; then
36 - best_impl=${MULTIBUILD_VARIANT}
37 - fi
38 - done
39 + if _python_impl_matches "${EPYTHON}" "${patterns[@]}"; then
40 + best_impl=${MULTIBUILD_VARIANT}
41 + fi
42 }
43 python_foreach_impl _distutils_try_impl
44 unset -f _distutils_try_impl
45 --
46 2.13.0