summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-17 13:22:35 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-17 13:22:35 -0700
commitdaa712622ddf9b909f208952e8d594e5fd4525b0 (patch)
treec99a359f7e9cbae0f1f9ec297f1d31b4db3fafb4
parent7c30e35b614171fa26097944fa0d48e8de88f486 (diff)
downloadportage-daa712622ddf9b909f208952e8d594e5fd4525b0.tar.gz
portage-daa712622ddf9b909f208952e8d594e5fd4525b0.tar.bz2
portage-daa712622ddf9b909f208952e8d594e5fd4525b0.zip
Temporarily disable portage.dep deprecation warnings for external api
consumers. Once the relevant api changes are in a portage release with stable keywords, make these warnings unconditional.
-rwxr-xr-xbin/ebuild1
-rwxr-xr-xbin/repoman1
-rw-r--r--pym/_emerge/main.py1
-rw-r--r--pym/portage/dep/__init__.py32
4 files changed, 24 insertions, 11 deletions
diff --git a/bin/ebuild b/bin/ebuild
index 658652f5a..3600881f3 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -69,6 +69,7 @@ except ImportError:
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
+portage.dep._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 dc7dc3bf8..bfe126f18 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -37,6 +37,7 @@ except ImportError:
sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
import portage
portage._disable_legacy_globals()
+portage.dep._internal_warnings = True
try:
import xml.etree.ElementTree
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index f8a8f22e4..c8a6ee4bf 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1241,6 +1241,7 @@ def check_procfs():
def emerge_main():
global portage # NFC why this is necessary now - genone
portage._disable_legacy_globals()
+ portage.dep._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
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index a16697835..84cc57526 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -39,6 +39,11 @@ import portage.cache.mappings
if sys.hexversion >= 0x3000000:
basestring = str
+# 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
+
def cpvequal(cpv1, cpv2):
"""
@@ -97,8 +102,9 @@ def paren_reduce(mystr):
@rtype: Array
@return: The reduced string in an array
"""
- warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
- ('portage.dep.paren_reduce',), DeprecationWarning, stacklevel=2)
+ if _internal_warnings:
+ warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
+ ('portage.dep.paren_reduce',), DeprecationWarning, stacklevel=2)
mysplit = mystr.split()
level = 0
stack = [[]]
@@ -164,8 +170,9 @@ 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):
- warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
- ('portage.dep.paren_normalize',), DeprecationWarning, stacklevel=2)
+ if _internal_warnings:
+ warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
+ ('portage.dep.paren_normalize',), DeprecationWarning, stacklevel=2)
list.__init__(self)
self._zap_parens(src, self)
@@ -252,9 +259,10 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
@return: The use reduced depend array
"""
if isinstance(depstr, list):
- warnings.warn(_("Passing paren_reduced dep arrays to %s is deprecated. " + \
- "Pass the original dep string instead.") % \
- ('portage.dep.use_reduce',), DeprecationWarning, stacklevel=2)
+ if _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)
depstr = paren_enclose(depstr)
if opconvert and flat:
@@ -464,8 +472,9 @@ def dep_opconvert(deplist):
@return:
The new list with the new ordering
"""
- 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)
+ if _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)
retlist = []
x = 0
@@ -494,8 +503,9 @@ def flatten(mylist):
@rtype: List
@return: A single list containing only non-list elements.
"""
- warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
- ('portage.dep.flatten',), DeprecationWarning, stacklevel=2)
+ if _internal_warnings:
+ warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
+ ('portage.dep.flatten',), DeprecationWarning, stacklevel=2)
newlist = []
for x in mylist: