Make cpv_getkey() use catpkgsplit() insead of a separate regex.
authorZac Medico <zmedico@gentoo.org>
Sun, 18 Oct 2009 00:10:51 +0000 (00:10 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 18 Oct 2009 00:10:51 +0000 (00:10 -0000)
svn path=/main/trunk/; revision=14628

pym/portage/__init__.py

index 0e2499addb18f5fa1243a13ae707c7d4b9555bc3..0ada1eb6836dcb0d9c26da0526e19c400d7e4d7d 100644 (file)
@@ -8309,12 +8309,11 @@ def dep_wordreduce(mydeplist,mysettings,mydbapi,mode,use_cache=1):
                                        return None
        return deplist
 
-_cpv_key_re = re.compile('^' + versions._cpv + '$', re.VERBOSE)
 def cpv_getkey(mycpv):
        """Calls pkgsplit on a cpv and returns only the cp."""
-       m = _cpv_key_re.match(mycpv)
-       if m is not None:
-               return m.group(2)
+       mysplit = versions.catpkgsplit(mycpv)
+       if mysplit is not None:
+               return mysplit[0] + '/' + mysplit[1]
 
        warnings.warn("portage.cpv_getkey() called with invalid cpv: '%s'" \
                % (mycpv,), DeprecationWarning)