Make dep_getkey() recommend cpv_getkey() if given a cpv. (trunk r15380)
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:34:07 +0000 (20:34 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:34:07 +0000 (20:34 -0000)
svn path=/main/branches/2.1.7/; revision=15607

pym/portage/dep.py

index fe3f04f5972feb01aedcad5f33bec9f20cffe59f..47da7cedb68093e79563cc0d356fa3d5ea84e8aa 100644 (file)
@@ -937,9 +937,14 @@ def dep_getkey(mydep):
                return Atom(mydep).cp
        except InvalidAtom:
                try:
-                       return Atom('=' + mydep).cp
+                       atom = Atom('=' + mydep)
                except InvalidAtom:
                        pass
+               else:
+                       warnings.warn(_("invalid input to %s: '%s', use %s instead") % \
+                               ('portage.dep.dep_getkey()', mydep, 'portage.cpv_getkey()'),
+                               DeprecationWarning)
+                       return atom.cp
 
        # Fall back to legacy code for backward compatibility.
        warnings.warn(_("%s is deprecated, use %s instead") % \