diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-09-14 02:45:33 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-09-14 02:45:33 +0000 |
commit | 3d0133b5422d23a203b8bb9e93f05e85c84c886b (patch) | |
tree | ee9296014cf0ecb38714a54a9a085445a507c682 | |
parent | 5cd73b5702d343072e7c0ed3a73de6e1951a77b1 (diff) | |
download | portage-3d0133b5422d23a203b8bb9e93f05e85c84c886b.tar.gz portage-3d0133b5422d23a203b8bb9e93f05e85c84c886b.tar.bz2 portage-3d0133b5422d23a203b8bb9e93f05e85c84c886b.zip |
Simlify the Atom regex. Thanks to Marat Radchenko <marat@slonopotamus.org>
for this patch.
svn path=/main/trunk/; revision=14249
-rw-r--r-- | pym/portage/dep.py | 13 |
1 files changed, 4 insertions, 9 deletions
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>' + _op + _cpv + _optional_slot + _use + ')|' + - '(?P<star>=' + _cpv + r'\*' + _optional_slot + _use + ')|' + - '(?P<simple>' + _cp + _optional_slot + _use + ')' + - ')$', re.VERBOSE) -_key_re = re.compile(_cp + '(?:-' + _version + '|' + _slot + '|$)', re.VERBOSE) + '(?P<op>' + _op + _cpv + ')|' + + '(?P<star>=' + _cpv + r'\*)|' + + '(?P<simple>' + _cp + '))' + _optional_slot + _use + '$', re.VERBOSE) def isvalidatom(atom, allow_blockers=False): """ |