('portage.dep.strip_empty',), DeprecationWarning, stacklevel=2)
return [x for x in myarr if x]
-def paren_reduce(mystr):
+def paren_reduce(mystr, _deprecation_warn=True):
"""
Take a string and convert all paren enclosed entities into sublists and
split the list elements by spaces. All redundant brackets are removed.
@rtype: Array
@return: The reduced string in an array
"""
- if portage._internal_caller:
+ if portage._internal_caller and _deprecation_warn:
warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
('portage.dep.paren_reduce',), DeprecationWarning, stacklevel=2)
mysplit = mystr.split()
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.tests import TestCase
)
for dep_str, expected_result in test_cases:
- self.assertEqual(paren_reduce(dep_str), expected_result,
+ self.assertEqual(paren_reduce(dep_str, _deprecation_warn=False),
+ expected_result,
"input: '%s' result: %s != %s" % (dep_str,
- paren_reduce(dep_str), expected_result))
+ paren_reduce(dep_str, _deprecation_warn=False),
+ expected_result))
for dep_str in test_cases_xfail:
self.assertRaisesMsg(dep_str,
- InvalidDependString, paren_reduce, dep_str)
+ InvalidDependString, paren_reduce, dep_str,
+ _deprecation_warn=False)