From: Zac Medico Date: Tue, 16 Oct 2012 23:31:48 +0000 (-0700) Subject: Move portage.dep._internal_warnings to portage. X-Git-Tag: v2.2.0_alpha139 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f1e4d32191ad46460043f1fa83ca447c657678e2;p=portage.git Move portage.dep._internal_warnings to portage. --- diff --git a/bin/ebuild b/bin/ebuild index a21ef648a..36580bf3f 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -68,7 +68,7 @@ from os import path as osp pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym") sys.path.insert(0, pym_path) import portage -portage.dep._internal_warnings = True +portage._internal_warnings = True from portage import os from portage import _encodings from portage import _shell_quote diff --git a/bin/repoman b/bin/repoman index a95910641..ba0ec9a04 100755 --- a/bin/repoman +++ b/bin/repoman @@ -39,7 +39,7 @@ pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym") sys.path.insert(0, pym_path) import portage portage._disable_legacy_globals() -portage.dep._internal_warnings = True +portage._internal_warnings = True try: import xml.etree.ElementTree diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index ef91fc62d..be5a5cad4 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -974,11 +974,11 @@ def emerge_main(args=None): if args is None: args = sys.argv[1:] + portage._disable_legacy_globals() + portage._internal_warnings = True # Disable color until we're sure that it should be enabled (after # EMERGE_DEFAULT_OPTS has been parsed). portage.output.havecolor = 0 - portage._disable_legacy_globals() - portage.dep._internal_warnings = True # This first pass is just for options that need to be known as early as # possible, such as --config-root. They will be parsed again later, diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 667bf6fd9..08d9e5d86 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -334,6 +334,9 @@ _python_interpreter = os.path.realpath(sys.executable) _bin_path = PORTAGE_BIN_PATH _pym_path = PORTAGE_PYM_PATH +# Api consumers included in portage should set this to True. +_internal_warnings = False + _sync_disabled_warnings = False def _shell_quote(s): diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index bc9d33e81..55181d71e 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -36,11 +36,6 @@ if sys.hexversion >= 0x3000000: else: _unicode = unicode -# Api consumers included in portage should set this to True. -# Once the relevant api changes are in a portage release with -# stable keywords, make these warnings unconditional. -_internal_warnings = False - # \w is [a-zA-Z0-9_] # PMS 3.1.3: A slot name may contain any of the characters [A-Za-z0-9+_.-]. @@ -274,7 +269,7 @@ def paren_reduce(mystr): @rtype: Array @return: The reduced string in an array """ - if _internal_warnings: + if portage._internal_warnings: warnings.warn(_("%s is deprecated and will be removed without replacement.") % \ ('portage.dep.paren_reduce',), DeprecationWarning, stacklevel=2) mysplit = mystr.split() @@ -366,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 _internal_warnings: + if portage._internal_warnings: warnings.warn(_("%s is deprecated and will be removed without replacement.") % \ ('portage.dep.paren_normalize',), DeprecationWarning, stacklevel=2) list.__init__(self) @@ -462,7 +457,7 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i @return: The use reduced depend array """ if isinstance(depstr, list): - if _internal_warnings: + if portage._internal_warnings: warnings.warn(_("Passing paren_reduced dep arrays to %s is deprecated. " + \ "Pass the original dep string instead.") % \ ('portage.dep.use_reduce',), DeprecationWarning, stacklevel=2) @@ -763,7 +758,7 @@ def dep_opconvert(deplist): @return: The new list with the new ordering """ - if _internal_warnings: + if portage._internal_warnings: 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) @@ -794,7 +789,7 @@ def flatten(mylist): @rtype: List @return: A single list containing only non-list elements. """ - if _internal_warnings: + if portage._internal_warnings: warnings.warn(_("%s is deprecated and will be removed without replacement.") % \ ('portage.dep.flatten',), DeprecationWarning, stacklevel=2)