From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SdqlE-0005xY-Bb for garchives@archives.gentoo.org; Sun, 10 Jun 2012 22:37:28 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 72FB5E05DB; Sun, 10 Jun 2012 22:37:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 400A2E05DB for ; Sun, 10 Jun 2012 22:37:21 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9F2B51B403E for ; Sun, 10 Jun 2012 22:37:20 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 6155AE542E for ; Sun, 10 Jun 2012 22:37:19 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1339367826.78e30816903b489106885232c55a2717b51986f8.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dep/__init__.py X-VCS-Directories: pym/portage/dep/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 78e30816903b489106885232c55a2717b51986f8 X-VCS-Branch: master Date: Sun, 10 Jun 2012 22:37:19 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 49a07521-03bb-4e47-8d3f-9257f858e48f X-Archives-Hash: 89dba69459ee11ec718dcf27a63ed89a commit: 78e30816903b489106885232c55a2717b51986f8 Author: Zac Medico gentoo org> AuthorDate: Sun Jun 10 22:37:06 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Jun 10 22:37:06 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D78e30816 _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] =3D atom_re return atom_re =20 +_atom_wildcard_re_cache =3D {} + +def _get_atom_wildcard_re(eapi_attrs): + cache_key =3D eapi_attrs.dots_in_PN + atom_re =3D _atom_wildcard_re_cache.get(cache_key) + if atom_re is not None: + return atom_re + + if eapi_attrs.dots_in_PN: + pkg_re =3D r'[\w+*][\w+.*-]*?' + else: + pkg_re =3D r'[\w+*][\w+*-]*?' + + atom_re =3D re.compile(r'(?P(' + + _extended_cat + r')/(' + pkg_re + + r'))(:(?P' + _slot + r'))?(' + + _repo_separator + r'(?P' + _repo_name + r'))?$') + + _atom_wildcard_re_cache[cache_key] =3D atom_re + return atom_re + _usedep_re_cache =3D {} =20 def _get_usedep_re(eapi_attrs): @@ -1199,7 +1220,7 @@ class Atom(_atom_base): extended_syntax =3D False if m is None: if allow_wildcard: - m =3D _get_atom_wildcard_re(eapi).match(s) + m =3D _get_atom_wildcard_re(eapi_attrs).match(s) if m is None: raise InvalidAtom(self) op =3D None @@ -1755,21 +1776,6 @@ _repo_name =3D r'[\w][\w-]*' _repo =3D r'(?:' + _repo_separator + '(' + _repo_name + ')' + ')?' =20 _extended_cat =3D r'[\w+*][\w+.*-]*' -_extended_pkg =3D { - "dots_disallowed_in_PN": r'[\w+*][\w+*-]*?', - "dots_allowed_in_PN": r'[\w+*][\w+.*-]*?', -} - -_atom_wildcard_re =3D { - "dots_disallowed_in_PN": re.compile('(?P(' + _extended_cat + ')= /(' + _extended_pkg['dots_disallowed_in_PN'] + '))(:(?P' + _slot + = '))?(' + _repo_separator + '(?P' + _repo_name + '))?$'), - "dots_allowed_in_PN": re.compile('(?P(' + _extended_cat + ')= /(' + _extended_pkg['dots_allowed_in_PN'] + '))(:(?P' + _slot + '))= ?(' + _repo_separator + '(?P' + _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"] =20 def isvalidatom(atom, allow_blockers=3DFalse, allow_wildcard=3DFalse, al= low_repo=3DFalse): """