From cc028a311bcac5297c536e5cf96b0df5045c675f Mon Sep 17 00:00:00 2001 From: Sebastian Luther Date: Tue, 12 Oct 2010 16:34:37 +0200 Subject: [PATCH] Allow repository specs for atoms with wildcards --- pym/portage/dep/__init__.py | 4 ++-- pym/portage/tests/dep/testAtom.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 268ebb643..b829e8045 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -1010,7 +1010,7 @@ class Atom(_atom_base): if cpv.find("**") != -1: raise InvalidAtom(self) slot = gdict['slot'] - repo = None + repo = gdict['repo'] use_str = None extended_syntax = True else: @@ -1529,7 +1529,7 @@ _atom_re = re.compile('^(?P(?:' + _extended_cat = r'[\w+*][\w+.*-]*' _extended_pkg = r'[\w+*][\w+*-]*?' -_atom_wildcard_re = re.compile('(?P(' + _extended_cat + ')/(' + _extended_pkg + '))(:(?P' + _slot + '))?$') +_atom_wildcard_re = re.compile('(?P(' + _extended_cat + ')/(' + _extended_pkg + '))(:(?P' + _slot + '))?(' + _repo_separator + '(?P' + _repo_name + '))?$') _valid_use_re = re.compile(r'^[A-Za-z0-9][A-Za-z0-9+_@-]*$') diff --git a/pym/portage/tests/dep/testAtom.py b/pym/portage/tests/dep/testAtom.py index a1dea8c1f..092cacf84 100644 --- a/pym/portage/tests/dep/testAtom.py +++ b/pym/portage/tests/dep/testAtom.py @@ -47,6 +47,15 @@ class TestAtom(TestCase): ('=*', 'sys-apps/portage', '2.1-r1', '0', '[doc]', 'repo_name'), False, True ), ( "sys-apps/portage:0::repo_name[doc]", (None, 'sys-apps/portage', None, '0', '[doc]', 'repo_name'), False, True ), + + ( "*/*::repo_name", + (None, '*/*', None, None, None, 'repo_name'), True, True ), + ( "sys-apps/*::repo_name", + (None, 'sys-apps/*', None, None, None, 'repo_name'), True, True ), + ( "*/portage::repo_name", + (None, '*/portage', None, None, None, 'repo_name'), True, True ), + ( "s*s-*/portage:1::repo_name", + (None, 's*s-*/portage', None, '1', None, 'repo_name'), True, True ), ) tests_xfail = ( @@ -103,6 +112,7 @@ class TestAtom(TestCase): ( "=sys-apps/portage-2.1-r1:0::repo_name[doc,a=,!b=,c?,!d?,-e]", False, False ), ( "=sys-apps/portage-2.1-r1*:0::repo_name[doc]", False, False ), ( "sys-apps/portage:0::repo_name[doc]", False, False ), + ( "*/*::repo_name", True, False ), ) for atom, parts, allow_wildcard, allow_repo in tests: -- 2.26.2