diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-25 03:13:06 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-25 03:13:06 +0000 |
commit | cdcde7c2274da95c0b6fddf8750588c89cf2f842 (patch) | |
tree | 7524df82bdd809b3ac94c62d8bceab39434164b7 /pym/portage_dep.py | |
parent | 2cfeeb2014b3648cc63f1f959afc70807ba15450 (diff) | |
download | portage-cdcde7c2274da95c0b6fddf8750588c89cf2f842.tar.gz portage-cdcde7c2274da95c0b6fddf8750588c89cf2f842.tar.bz2 portage-cdcde7c2274da95c0b6fddf8750588c89cf2f842.zip |
Fix isvalidatom() so tests pass, and add a USE deps case to the tests.
(trunk r10399)
svn path=/main/branches/2.1.2/; revision=10401
Diffstat (limited to 'pym/portage_dep.py')
-rw-r--r-- | pym/portage_dep.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pym/portage_dep.py b/pym/portage_dep.py index 4fe95d9b3..bad51b646 100644 --- a/pym/portage_dep.py +++ b/pym/portage_dep.py @@ -369,6 +369,7 @@ def remove_slot(mydep): mydep = mydep[:colon] return mydep +_valid_category = re.compile("^\w[\w-]*") _invalid_atom_chars_regexp = re.compile("[()|?@\[\]]") def isvalidatom(atom, allow_blockers=False): @@ -393,10 +394,13 @@ def isvalidatom(atom, allow_blockers=False): return 0 if allow_blockers and atom.startswith("!"): atom = atom[1:] - try: - mycpv_cps = catpkgsplit(dep_getcpv(atom)) - except InvalidData: - return 0 + cpv = dep_getcpv(atom) + if cpv: + if _valid_category.match(catsplit(cpv)[0]) is None: + return 0 + mycpv_cps = catpkgsplit(cpv) + else: + mycpv_cps = None operator = get_operator(atom) if operator: if operator[0] in "<>" and remove_slot(atom).endswith("*"): |