if token in operator_tokens or \
token.endswith("?"):
continue
- if not portage.isvalidatom(token) or \
+ if not portage.isvalidatom(token, allow_blockers=True) or \
":" in token and myaux["EAPI"] == "0":
badsyntax.append("'%s' not a valid atom" % token)
_invalid_atom_chars_regexp = re.compile("[()|?]")
-def isvalidatom(atom):
+def isvalidatom(atom, allow_blockers=False):
"""
Check to see if a depend atom is valid
global _invalid_atom_chars_regexp
if _invalid_atom_chars_regexp.search(atom):
return 0
+ if allow_blockers and atom.startswith("!"):
+ atom = atom[1:]
mycpv_cps = catpkgsplit(dep_getcpv(atom))
operator = get_operator(atom)
if operator:
"""
global _match_from_list_cache
- mylist = _match_from_list_cache.get(
- hash((mydep, tuple(candidate_list))), None)
+ cache_key = (mydep, tuple(candidate_list))
+ mylist = _match_from_list_cache.get(cache_key, None)
if mylist is not None:
return mylist[:]
else:
raise KeyError("Unknown operator: %s" % mydep)
- _match_from_list_cache[hash((mydep, tuple(candidate_list)))] = mylist
+ _match_from_list_cache[cache_key] = mylist
return mylist