summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-10-15 02:09:16 -0700
committerZac Medico <zmedico@gentoo.org>2010-10-15 03:06:20 -0700
commit64751923ebb1f59e3690fb5640e8ae5a19b7a5b2 (patch)
treeee1841808e5a3662ab7cae937093dde9584418c1
parentf077d2a94094aeb9d3eecb4c8399f2e9e3b274d9 (diff)
downloadportage-64751923ebb1f59e3690fb5640e8ae5a19b7a5b2.tar.gz
portage-64751923ebb1f59e3690fb5640e8ae5a19b7a5b2.tar.bz2
portage-64751923ebb1f59e3690fb5640e8ae5a19b7a5b2.zip
Fix use_reduce + opconvert of "|| ( A B ) C".
Also, tweak other test results to match the additional brackets that this change introduces in some cases.
-rw-r--r--pym/portage/dep/__init__.py2
-rw-r--r--pym/portage/tests/dep/test_use_reduce.py26
2 files changed, 11 insertions, 17 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index da67dd1fe..d9f6a2155 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -477,7 +477,7 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
#In opconvert mode, we have to move the operator from the level
#above into the current list.
stack[level].pop()
- stack[level].extend(["||"] + l)
+ 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 b9a2b3dd3..162d7cdf2 100644
--- a/pym/portage/tests/dep/test_use_reduce.py
+++ b/pym/portage/tests/dep/test_use_reduce.py
@@ -276,19 +276,19 @@ class UseReduce(TestCase):
UseReduceTestCase(
"|| ( A B )",
opconvert = True,
- expected_result = ["||", "A", "B"]),
+ expected_result = [['||', 'A', 'B']]),
UseReduceTestCase(
"|| ( ( A B ) C )",
opconvert = True,
- expected_result = [ "||", ["A", "B"], "C" ]),
+ expected_result = [['||', ['A', 'B'], 'C']]),
UseReduceTestCase(
"|| ( A || ( B C ) )",
opconvert = True,
- expected_result = ["||", "A", "B", "C"]),
+ expected_result = [['||', 'A', 'B', 'C']]),
UseReduceTestCase(
"|| ( A || ( B C D ) )",
opconvert = True,
- expected_result = ["||", "A", "B", "C", "D"]),
+ expected_result = [['||', 'A', 'B', 'C', 'D']]),
UseReduceTestCase(
"|| ( A || ( B || ( C D ) E ) )",
expected_result = [ "||", ["A", "B", "C", "D", "E"] ]),
@@ -299,17 +299,11 @@ class UseReduce(TestCase):
UseReduceTestCase(
"( || ( || ( ( A ) B ) ) )",
opconvert = True,
- expected_result = ["||", "A", "B"]),
+ expected_result = [['||', 'A', 'B']]),
UseReduceTestCase(
- "( || ( || ( ( A ) B ) ) )",
+ "|| ( A B ) C",
opconvert = True,
- expected_result = ["||", "A", "B"]),
-
- # ['||', 'A', 'B', 'C'] != [['||', 'A', 'B'], 'C']
- #UseReduceTestCase(
- # "|| ( A B ) C",
- # opconvert = True,
- # expected_result = [['||', 'A', 'B'], 'C']),
+ expected_result = [['||', 'A', 'B'], 'C']),
# ['A', '||', ['B', 'C']] != ['A', ['||', 'B', 'C']]
#UseReduceTestCase(
@@ -328,7 +322,7 @@ class UseReduce(TestCase):
"( || ( || ( || ( A ) foo? ( B ) ) ) )",
uselist = ["foo"],
opconvert = True,
- expected_result = ["||", "A", "B"]),
+ expected_result = [['||', 'A', 'B']]),
UseReduceTestCase(
"( || ( || ( bar? ( A ) || ( foo? ( B ) ) ) ) )",
opconvert = True,
@@ -337,7 +331,7 @@ class UseReduce(TestCase):
"( || ( || ( bar? ( A ) || ( foo? ( B ) ) ) ) )",
uselist = ["foo", "bar"],
opconvert = True,
- expected_result = ["||", "A", "B"]),
+ expected_result = [['||', 'A', 'B']]),
UseReduceTestCase(
"A || ( ) foo? ( ) B",
opconvert = True,
@@ -365,7 +359,7 @@ class UseReduce(TestCase):
"|| ( ( A B ) foo? ( || ( C D ) ) )",
uselist = ["foo"],
opconvert = True,
- expected_result = ['||', ['A', 'B'], 'C', 'D']),
+ expected_result = [['||', ['A', 'B'], '||', 'C', 'D']]),
UseReduceTestCase(
"|| ( ( A B ) foo? ( || ( C D ) ) )",