From 954de19e3a8330194e82e4faae7da7cf8ad7f7b5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 14 Oct 2010 11:37:19 -0700 Subject: [PATCH] Fix use_reduce() case from bug #340973. --- pym/portage/dep/__init__.py | 7 +++++-- pym/portage/tests/dep/test_use_reduce.py | 11 +++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index b829e8045..4de9c8422 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -441,8 +441,11 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i if opconvert and ends_in_any_of_dep(level): #In opconvert mode, we have to move the operator from the level #above into the current list. - stack[level].pop() - stack[level].append(["||"] + l) + if l[0] == '||': + stack[level].extend(l[1:]) + else: + stack[level].pop() + stack[level].append(["||"] + l) else: special_append() diff --git a/pym/portage/tests/dep/test_use_reduce.py b/pym/portage/tests/dep/test_use_reduce.py index b9551db61..ac7b585be 100644 --- a/pym/portage/tests/dep/test_use_reduce.py +++ b/pym/portage/tests/dep/test_use_reduce.py @@ -342,12 +342,11 @@ class UseReduce(TestCase): uselist = ["foo"], opconvert = True, expected_result = ["A", "B"]), - # FIXME: Bug #340973: [['||', '||', 'A', 'B']] != ["||", "A", "B"] - #UseReduceTestCase( - # "|| ( foo? ( || ( A B ) ) )", - # uselist = ["foo"], - # opconvert = True, - # expected_result = ["||", "A", "B"]), + UseReduceTestCase( + "|| ( foo? ( || ( A B ) ) )", + uselist = ["foo"], + opconvert = True, + expected_result = ["||", "A", "B"]), #flat test UseReduceTestCase( -- 2.26.2