summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/dep.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py
index 782405f49..ae6d43ab5 100644
--- a/pym/portage/dep.py
+++ b/pym/portage/dep.py
@@ -738,8 +738,6 @@ def get_operator(mydep):
return operator
-_dep_getcpv_cache = {}
-
def dep_getcpv(mydep):
"""
Return the category-package-version with any operators/slot specifications stripped off
@@ -753,13 +751,13 @@ def dep_getcpv(mydep):
@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)
@@ -776,7 +774,6 @@ def dep_getcpv(mydep):
mydep = mydep[2:]
elif mydep[:1] in "=<>~":
mydep = mydep[1:]
- _dep_getcpv_cache[mydep_orig] = mydep
return mydep
def dep_getslot(mydep):