Move portage.dep._internal_warnings to portage.
diff --git a/bin/ebuild b/bin/ebuild
index a21ef64..36580bf 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -68,7 +68,7 @@
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 a959106..ba0ec9a 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -39,7 +39,7 @@
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 ef91fc6..be5a5ca 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -974,11 +974,11 @@
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 667bf6f..08d9e5d 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -334,6 +334,9 @@
_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 bc9d33e..55181d7 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -36,11 +36,6 @@
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 @@
@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 @@
"""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 @@
@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 @@
@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 @@
@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)