From: Zac Medico Date: Mon, 14 Sep 2009 02:45:33 +0000 (-0000) Subject: Simlify the Atom regex. Thanks to Marat Radchenko X-Git-Tag: v2.2_rc41~25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3d0133b5422d23a203b8bb9e93f05e85c84c886b;p=portage.git Simlify the Atom regex. Thanks to Marat Radchenko for this patch. svn path=/main/trunk/; revision=14249 --- diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 1e27e882d..e1f669970 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -549,21 +549,18 @@ class Atom(object): op = m.group(_atom_re.groupindex['op'] + 1) cpv = m.group(_atom_re.groupindex['op'] + 2) cp = m.group(_atom_re.groupindex['op'] + 3) - slot = m.group(_atom_re.groupindex['star'] - 2) elif m.group('star'): op = '=*' cpv = m.group(_atom_re.groupindex['star'] + 1) cp = m.group(_atom_re.groupindex['star'] + 2) - slot = m.group(_atom_re.groupindex['simple'] - 2) elif m.group('simple'): op = None cpv = cp = m.group(_atom_re.groupindex['simple'] + 1) - slot = m.group(_atom_re.groups - 1) else: raise AssertionError("required group not found in atom: '%s'" % s) obj_setattr(self, "cp", cp) obj_setattr(self, "cpv", cpv) - obj_setattr(self, "slot", slot) + obj_setattr(self, "slot", m.group(_atom_re.groups - 1)) obj_setattr(self, "operator", op) use = dep_getusedeps(s) @@ -890,11 +887,9 @@ _cpv = '(' + _cp + '-' + _version + ')' _cpv_re = re.compile('^' + _cpv + '$', re.VERBOSE) _atom_re = re.compile('^(?:' + - '(?P' + _op + _cpv + _optional_slot + _use + ')|' + - '(?P=' + _cpv + r'\*' + _optional_slot + _use + ')|' + - '(?P' + _cp + _optional_slot + _use + ')' + - ')$', re.VERBOSE) -_key_re = re.compile(_cp + '(?:-' + _version + '|' + _slot + '|$)', re.VERBOSE) + '(?P' + _op + _cpv + ')|' + + '(?P=' + _cpv + r'\*)|' + + '(?P' + _cp + '))' + _optional_slot + _use + '$', re.VERBOSE) def isvalidatom(atom, allow_blockers=False): """