diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-10-15 02:28:54 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-10-15 02:28:54 -0700 |
commit | 26ccc25818aa1f440260a098a03b25e675f00d6b (patch) | |
tree | ea00f23252a9bb8e3097be8392df102095c029fb | |
parent | 32092a07dc506df221382ca49faba420c776f6f1 (diff) | |
download | portage-26ccc25818aa1f440260a098a03b25e675f00d6b.tar.gz portage-26ccc25818aa1f440260a098a03b25e675f00d6b.tar.bz2 portage-26ccc25818aa1f440260a098a03b25e675f00d6b.zip |
Fix use_reduce + opconvert of "A || ( B C )".
-rw-r--r-- | pym/portage/dep/__init__.py | 5 | ||||
-rw-r--r-- | pym/portage/tests/dep/test_use_reduce.py | 10 |
2 files changed, 8 insertions, 7 deletions
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 )", |