From cbbab21dfdd9bee79cddaaac12d7ea5890674d81 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 3 Jan 2013 15:04:40 -0800 Subject: Add portage._internal_caller var, and use it. --- pym/portage/__init__.py | 4 ++-- pym/portage/dbapi/porttree.py | 4 ++-- pym/portage/dep/__init__.py | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'pym/portage') diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 96a4fa98c..169c19783 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1,5 +1,5 @@ # portage.py -- core Portage functionality -# Copyright 1998-2012 Gentoo Foundation +# Copyright 1998-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 VERSION="HEAD" @@ -335,7 +335,7 @@ _bin_path = PORTAGE_BIN_PATH _pym_path = PORTAGE_PYM_PATH # Api consumers included in portage should set this to True. -_internal_warnings = False +_internal_caller = False _sync_disabled_warnings = False diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index ebb1be87a..d8cd261b4 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -1,4 +1,4 @@ -# Copyright 1998-2012 Gentoo Foundation +# Copyright 1998-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = [ @@ -197,7 +197,7 @@ class portdbapi(dbapi): @property def _event_loop(self): - if portage._internal_warnings: + if portage._internal_caller: # For internal portage usage, the global_event_loop is safe. return global_event_loop() else: diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 634b42bb5..916d5ea66 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -1,5 +1,5 @@ # deps.py -- Portage dependency resolution functions -# Copyright 2003-2012 Gentoo Foundation +# Copyright 2003-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = [ @@ -269,7 +269,7 @@ def paren_reduce(mystr): @rtype: Array @return: The reduced string in an array """ - if portage._internal_warnings: + if portage._internal_caller: warnings.warn(_("%s is deprecated and will be removed without replacement.") % \ ('portage.dep.paren_reduce',), DeprecationWarning, stacklevel=2) mysplit = mystr.split() @@ -361,7 +361,7 @@ class paren_normalize(list): """Take a dependency structure as returned by paren_reduce or use_reduce and generate an equivalent structure that has no redundant lists.""" def __init__(self, src): - if portage._internal_warnings: + if portage._internal_caller: warnings.warn(_("%s is deprecated and will be removed without replacement.") % \ ('portage.dep.paren_normalize',), DeprecationWarning, stacklevel=2) list.__init__(self) @@ -457,7 +457,7 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i @return: The use reduced depend array """ if isinstance(depstr, list): - if portage._internal_warnings: + if portage._internal_caller: warnings.warn(_("Passing paren_reduced dep arrays to %s is deprecated. " + \ "Pass the original dep string instead.") % \ ('portage.dep.use_reduce',), DeprecationWarning, stacklevel=2) @@ -758,7 +758,7 @@ def dep_opconvert(deplist): @return: The new list with the new ordering """ - if portage._internal_warnings: + if portage._internal_caller: warnings.warn(_("%s is deprecated. Use %s with the opconvert parameter set to True instead.") % \ ('portage.dep.dep_opconvert', 'portage.dep.use_reduce'), DeprecationWarning, stacklevel=2) @@ -789,7 +789,7 @@ def flatten(mylist): @rtype: List @return: A single list containing only non-list elements. """ - if portage._internal_warnings: + if portage._internal_caller: warnings.warn(_("%s is deprecated and will be removed without replacement.") % \ ('portage.dep.flatten',), DeprecationWarning, stacklevel=2) -- cgit v1.2.3-1-g7c22