From: Zac Medico Date: Fri, 19 Feb 2010 11:00:14 +0000 (-0000) Subject: Bug #303519 - Call warnings.warn() with stacklevel=2 inside dep_getkey and X-Git-Tag: v2.2_rc63~15 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bb14921cd21ec8366b6c974aa09dd1ec00a4729a;p=portage.git Bug #303519 - Call warnings.warn() with stacklevel=2 inside dep_getkey and dep_getcpv so that the caller is displayed. svn path=/main/trunk/; revision=15392 --- diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 80b97c763..c0abdcbde 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -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)