public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: python@gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 4/4] python-utils-r1.eclass: _python_impl_matches, handle both forms of impl
Date: Sat, 20 May 2017 10:56:16 +0200	[thread overview]
Message-ID: <20170520085616.5602-5-mgorny@gentoo.org> (raw)
In-Reply-To: <20170520085616.5602-1-mgorny@gentoo.org>

Make the pattern matching code in _python_impl_matches() more lax,
allowing (accidental) mixing of PYTHON_COMPAT-style values with
EPYTHON-style values. This is trivial to do, and solves the problem
introduced by complexity-by-limitation of other eclasses -- where
patterns for dependency strings are using PYTHON_COMPAT syntax,
and patterns for python_setup are using EPYTHON syntax.
---
 eclass/python-utils-r1.eclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 0bf7e7ec1a3e..68fb9ba2578d 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -169,7 +169,8 @@ _python_set_impls() {
 # Check whether the specified <impl> matches at least one
 # of the patterns following it. Return 0 if it does, 1 otherwise.
 #
-# <impl> should be in PYTHON_COMPAT form. The patterns can be either:
+# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
+# either:
 # a) fnmatch-style patterns, e.g. 'python2*', 'pypy'...
 # b) '-2' to indicate all Python 2 variants (= !python_is_python3)
 # c) '-3' to indicate all Python 3 variants (= python_is_python3)
@@ -186,7 +187,8 @@ _python_impl_matches() {
 		elif [[ ${pattern} == -3 ]]; then
 			python_is_python3 "${impl}"
 			return
-		elif [[ ${impl} == ${pattern} ]]; then
+		# unify value style to allow lax matching
+		elif [[ ${impl/./_} == ${pattern/./_} ]]; then
 			return 0
 		fi
 	done
-- 
2.13.0



  parent reply	other threads:[~2017-05-20  8:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-20  8:56 [gentoo-dev] [PATCHES] python-r1 suite: minor fixes Michał Górny
2017-05-20  8:56 ` [gentoo-dev] [PATCH 1/4] python-any-r1.eclass: python_gen_any_dep, add missing 'local i' Michał Górny
2017-05-20  8:56 ` [gentoo-dev] [PATCH 2/4] python-r1.eclass: python_setup, add REQUIRED_USE to the example Michał Górny
2017-05-20  8:56 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Use _python_impl_matches() Michał Górny
2017-05-20  8:56 ` Michał Górny [this message]
2017-06-06  6:59 ` [gentoo-dev] [PATCHES] python-r1 suite: minor fixes Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170520085616.5602-5-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=python@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox