From: Zac Medico Date: Fri, 15 Oct 2010 09:28:54 +0000 (-0700) Subject: Fix use_reduce + opconvert of "A || ( B C )". X-Git-Tag: v2.2_rc97~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=26ccc25818aa1f440260a098a03b25e675f00d6b;p=portage.git Fix use_reduce + opconvert of "A || ( B C )". --- diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index d9f6a2155..010d88351 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -453,7 +453,10 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i else: stack[level].extend(l) else: - stack[level].append(l) + if opconvert and stack[level] and stack[level][-1] == '||': + stack[level][-1] = ['||'] + l + else: + stack[level].append(l) if l and not ignore: #The current list is not empty and we don't want to ignore it because diff --git a/pym/portage/tests/dep/test_use_reduce.py b/pym/portage/tests/dep/test_use_reduce.py index 162d7cdf2..32a9e50d5 100644 --- a/pym/portage/tests/dep/test_use_reduce.py +++ b/pym/portage/tests/dep/test_use_reduce.py @@ -304,12 +304,10 @@ class UseReduce(TestCase): "|| ( A B ) C", opconvert = True, expected_result = [['||', 'A', 'B'], 'C']), - - # ['A', '||', ['B', 'C']] != ['A', ['||', 'B', 'C']] - #UseReduceTestCase( - # "A || ( B C )", - # opconvert = True, - # expected_result = ['A', ['||', 'B', 'C']]), + UseReduceTestCase( + "A || ( B C )", + opconvert = True, + expected_result = ['A', ['||', 'B', 'C']]), UseReduceTestCase( "|| ( A )",