public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/
Date: Sun, 10 Jun 2012 22:37:19 +0000 (UTC)	[thread overview]
Message-ID: <1339367826.78e30816903b489106885232c55a2717b51986f8.zmedico@gentoo> (raw)

commit:     78e30816903b489106885232c55a2717b51986f8
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 22:37:06 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 22:37:06 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=78e30816

_get_atom_wildcard_re: use _eapi_attrs

---
 pym/portage/dep/__init__.py |   38 ++++++++++++++++++++++----------------
 1 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 27b90b9..5e747a1 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -108,6 +108,27 @@ def _get_atom_re(eapi_attrs):
 	_atom_re_cache[cache_key] = atom_re
 	return atom_re
 
+_atom_wildcard_re_cache = {}
+
+def _get_atom_wildcard_re(eapi_attrs):
+	cache_key = eapi_attrs.dots_in_PN
+	atom_re = _atom_wildcard_re_cache.get(cache_key)
+	if atom_re is not None:
+		return atom_re
+
+	if eapi_attrs.dots_in_PN:
+		pkg_re = r'[\w+*][\w+.*-]*?'
+	else:
+		pkg_re = r'[\w+*][\w+*-]*?'
+
+	atom_re = re.compile(r'(?P<simple>(' +
+		_extended_cat + r')/(' + pkg_re +
+		r'))(:(?P<slot>' + _slot + r'))?(' +
+		_repo_separator + r'(?P<repo>' + _repo_name + r'))?$')
+
+	_atom_wildcard_re_cache[cache_key] = atom_re
+	return atom_re
+
 _usedep_re_cache = {}
 
 def _get_usedep_re(eapi_attrs):
@@ -1199,7 +1220,7 @@ class Atom(_atom_base):
 		extended_syntax = False
 		if m is None:
 			if allow_wildcard:
-				m = _get_atom_wildcard_re(eapi).match(s)
+				m = _get_atom_wildcard_re(eapi_attrs).match(s)
 				if m is None:
 					raise InvalidAtom(self)
 				op = None
@@ -1755,21 +1776,6 @@ _repo_name = r'[\w][\w-]*'
 _repo = r'(?:' + _repo_separator + '(' + _repo_name + ')' + ')?'
 
 _extended_cat = r'[\w+*][\w+.*-]*'
-_extended_pkg = {
-	"dots_disallowed_in_PN": r'[\w+*][\w+*-]*?',
-	"dots_allowed_in_PN":    r'[\w+*][\w+.*-]*?',
-}
-
-_atom_wildcard_re = {
-	"dots_disallowed_in_PN": re.compile('(?P<simple>(' + _extended_cat + ')/(' + _extended_pkg['dots_disallowed_in_PN'] + '))(:(?P<slot>' + _slot + '))?(' + _repo_separator + '(?P<repo>' + _repo_name + '))?$'),
-	"dots_allowed_in_PN":    re.compile('(?P<simple>(' + _extended_cat + ')/(' + _extended_pkg['dots_allowed_in_PN'] + '))(:(?P<slot>' + _slot + '))?(' + _repo_separator + '(?P<repo>' + _repo_name + '))?$'),
-}
-
-def _get_atom_wildcard_re(eapi):
-	if eapi is None or eapi_allows_dots_in_PN(eapi):
-		return _atom_wildcard_re["dots_allowed_in_PN"]
-	else:
-		return _atom_wildcard_re["dots_disallowed_in_PN"]
 
 def isvalidatom(atom, allow_blockers=False, allow_wildcard=False, allow_repo=False):
 	"""



             reply	other threads:[~2012-06-10 22:37 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-10 22:37 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-07-02 15:34 [gentoo-commits] proj/portage:master commit in: pym/portage/dep/ Brian Dolbec
2017-03-08 19:30 Zac Medico
2016-11-22 17:11 Zac Medico
2015-02-24 17:41 Zac Medico
2014-08-28  8:59 Michał Górny
2014-03-30 19:00 Sebastian Luther
2013-08-22  4:15 Zac Medico
2013-07-30  5:48 Zac Medico
2013-06-10  0:50 Zac Medico
2012-12-11  9:42 Arfrever Frehtes Taifersar Arahesis
2012-11-25 11:03 Arfrever Frehtes Taifersar Arahesis
2012-11-14 19:55 Zac Medico
2012-10-14 19:21 Zac Medico
2012-09-27 16:58 Zac Medico
2012-09-26  3:31 Zac Medico
2012-09-14  6:00 Zac Medico
2012-07-02 23:11 Zac Medico
2012-07-02 20:28 Zac Medico
2012-06-25 21:28 Zac Medico
2012-06-20  7:00 Zac Medico
2012-06-10 23:18 Zac Medico
2012-06-10 22:43 Zac Medico
2012-06-10 22:20 Zac Medico
2012-06-10 22:16 Zac Medico
2012-06-10 21:51 Zac Medico
2012-06-10 21:08 Zac Medico
2012-06-10 20:48 Zac Medico
2012-05-30  0:47 Arfrever Frehtes Taifersar Arahesis
2012-05-14  6:54 Zac Medico
2012-05-14  0:08 Zac Medico
2012-05-13 20:37 Zac Medico
2012-05-13 20:22 Zac Medico
2012-05-13  9:31 Zac Medico
2012-04-22 21:41 Zac Medico
2012-01-10 18:41 Zac Medico
2011-10-05 19:58 Zac Medico
2011-09-23  1:55 Zac Medico
2011-09-23  0:48 Zac Medico
2011-09-10 14:31 Zac Medico
2011-06-23 10:56 Arfrever Frehtes Taifersar Arahesis
2011-06-08 19:05 Zac Medico
2011-04-11 22:30 Zac Medico
2011-03-17 18:44 Zac Medico
2011-02-19 22:55 Zac Medico
2011-02-08 18:57 Zac Medico
2011-02-08  0:43 Zac Medico
2011-02-07 22:20 Zac Medico
2011-02-07 11:45 Zac Medico
2011-02-07 11:19 Zac Medico
2011-02-05  0:27 Zac Medico
2011-02-04 23:04 Zac Medico
2011-02-04  6:29 zmedico

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=1339367826.78e30816903b489106885232c55a2717b51986f8.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.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