Bug #303519 - Call warnings.warn() with stacklevel=2 inside dep_getkey and
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:38:03 +0000 (20:38 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:38:03 +0000 (20:38 -0000)
dep_getcpv so that the caller is displayed. (trunk r15392)

svn path=/main/branches/2.1.7/; revision=15614

pym/portage/dep.py

index 80b97c7635c8309c5a0a1b51b0edcf4efa871467..c0abdcbdea3ea0f5d863709183c6fe747bd70931 100644 (file)
@@ -708,7 +708,7 @@ def dep_getcpv(mydep):
        # Fall back to legacy code for backward compatibility.
        warnings.warn(_("%s is deprecated, use %s instead") % \
                ('portage.dep.dep_getcpv()', 'portage.dep.Atom.cpv'),
-               DeprecationWarning)
+               DeprecationWarning, stacklevel=2)
        mydep_orig = mydep
        if mydep:
                mydep = remove_slot(mydep)
@@ -943,13 +943,13 @@ def dep_getkey(mydep):
                else:
                        warnings.warn(_("invalid input to %s: '%s', use %s instead") % \
                                ('portage.dep.dep_getkey()', mydep, 'portage.cpv_getkey()'),
-                               DeprecationWarning)
+                               DeprecationWarning, stacklevel=2)
                        return atom.cp
 
        # Fall back to legacy code for backward compatibility.
        warnings.warn(_("%s is deprecated, use %s instead") % \
                ('portage.dep.dep_getkey()', 'portage.dep.Atom.cp'),
-               DeprecationWarning)
+               DeprecationWarning, stacklevel=2)
        mydep = dep_getcpv(mydep)
        if mydep and isspecific(mydep):
                mysplit = catpkgsplit(mydep)