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 02:09:16 -0700
commit32092a07dc506df221382ca49faba420c776f6f1 (patch)
treeaf34db3ffca0472d7245070ef18a9fd796be7688
parentf860e43d85e08a85cd189dbdbcae4bd87b990682 (diff)
downloadportage-32092a07dc506df221382ca49faba420c776f6f1.tar.gz
portage-32092a07dc506df221382ca49faba420c776f6f1.tar.bz2
portage-32092a07dc506df221382ca49faba420c776f6f1.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 ) ) )",