Fix use_reduce() case from bug #340973.
authorZac Medico <zmedico@gentoo.org>
Thu, 14 Oct 2010 18:37:19 +0000 (11:37 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 14 Oct 2010 18:37:19 +0000 (11:37 -0700)
pym/portage/dep/__init__.py
pym/portage/tests/dep/test_use_reduce.py

index b829e80451af7605e69995455d9aa2b7030d3470..4de9c8422a59ef32068df0730fe530bc92a8619f 100644 (file)
@@ -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()
 
index b9551db6115b3d75dfba9967e27ffbd96d404cbb..ac7b585be1f973ac19d3d1a0929fff766de0e88a 100644 (file)
@@ -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(