svn path=/main/trunk/; revision=14262
return operator
-_dep_getcpv_cache = {}
-
def dep_getcpv(mydep):
"""
Return the category-package-version with any operators/slot specifications stripped off
@rtype: String
@return: The depstring with the operator removed
"""
- cpv = getattr(mydep, "cpv", None)
- if cpv is not None:
- return cpv
- global _dep_getcpv_cache
- retval = _dep_getcpv_cache.get(mydep, None)
- if retval is not None:
- return retval
+
+ try:
+ return Atom(mydep).cpv
+ except InvalidAtom:
+ pass
+
+ # Fall back to legacy code for backward compatibility.
mydep_orig = mydep
if mydep:
mydep = remove_slot(mydep)
mydep = mydep[2:]
elif mydep[:1] in "=<>~":
mydep = mydep[1:]
- _dep_getcpv_cache[mydep_orig] = mydep
return mydep
def dep_getslot(mydep):