diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-09-14 08:11:22 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-09-14 08:11:22 +0000 |
commit | bb160436634cf872fa25c592871e2f6da589ecf5 (patch) | |
tree | 841a8f7fe219ef24b6b30b23cd132bd23296c565 | |
parent | b73a4762ec3a11a4ff7873738d0167a86d93d1c5 (diff) | |
download | portage-bb160436634cf872fa25c592871e2f6da589ecf5.tar.gz portage-bb160436634cf872fa25c592871e2f6da589ecf5.tar.bz2 portage-bb160436634cf872fa25c592871e2f6da589ecf5.zip |
Make dep_getcpv() use Atom, and fall back to legacy code for backward compat.
svn path=/main/trunk/; revision=14262
-rw-r--r-- | pym/portage/dep.py | 17 |
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): |