From 4899e3306e52f1eb365d09e95dd4754397f5de79 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 2 Mar 2010 20:38:03 +0000 Subject: [PATCH] Bug #303519 - Call warnings.warn() with stacklevel=2 inside dep_getkey and dep_getcpv so that the caller is displayed. (trunk r15392) svn path=/main/branches/2.1.7/; revision=15614 --- pym/portage/dep.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.26.2