diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-09-14 05:51:28 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-09-14 05:51:28 +0000 |
commit | 39172ce852a3b74ff00cf8d6566c6280be3202ae (patch) | |
tree | f90e342c636d6790e189cb404ba753f86362eaa7 | |
parent | 16870d2ca3c417bd2ce75d1005ce3c1a34cd64aa (diff) | |
download | portage-39172ce852a3b74ff00cf8d6566c6280be3202ae.tar.gz portage-39172ce852a3b74ff00cf8d6566c6280be3202ae.tar.bz2 portage-39172ce852a3b74ff00cf8d6566c6280be3202ae.zip |
Simplify isvalidatom() to simply use the Atom class. Thanks to Marat
Radchenko <marat@slonopotamus.org> for the suggestion.
svn path=/main/trunk/; revision=14252
-rw-r--r-- | pym/portage/dep.py | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 6c53b3ded..847c76eae 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -915,40 +915,10 @@ def isvalidatom(atom, allow_blockers=False): 1) False if the atom is invalid 2) True if the atom is valid """ - existing_atom = Atom._atoms.get(atom) - if existing_atom is not None: - atom = existing_atom - if isinstance(atom, Atom): - return allow_blockers or not atom.blocker - if len(atom) < 2: - return False - if allow_blockers and atom[0] == '!': - if atom[1] == '!': - atom = atom[2:] - else: - atom = atom[1:] - m = _atom_re.match(atom) - if m is None: - return False - - # Package name must not end in pattern - # which appears to be a valid version. - if m.group('op') is not None: - if m.group(_atom_re.groupindex['op'] + 4) is not None: - return False - elif m.group('star') is not None: - if m.group(_atom_re.groupindex['star'] + 3) is not None: - return False - elif m.group('simple') is not None: - if m.group(_atom_re.groupindex['simple'] + 2) is not None: - return False - else: - raise AssertionError(_("required group not found in atom: '%s'") % atom) - try: - use = dep_getusedeps(atom) - if use: - use = _use_dep(use) + atom = Atom(atom) + if not allow_blockers and atom.blocker: + return False return True except InvalidAtom: return False |