summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-02-04 14:31:32 -0800
committerZac Medico <zmedico@gentoo.org>2011-02-04 14:31:32 -0800
commit9ba0d885cddeb7de649e09a2c9276f25c4190b5e (patch)
treec5af6ecf4e9e84c5effdb36376010f93eae0c2e1
parent3791c8aa4cb242aa2b507b6bac368925aad067b1 (diff)
downloadportage-9ba0d885cddeb7de649e09a2c9276f25c4190b5e.tar.gz
portage-9ba0d885cddeb7de649e09a2c9276f25c4190b5e.tar.bz2
portage-9ba0d885cddeb7de649e09a2c9276f25c4190b5e.zip
check_required_use: clarify operator logic
-rw-r--r--pym/portage/dep/__init__.py15
-rw-r--r--pym/portage/tests/dep/testCheckRequiredUse.py5
2 files changed, 12 insertions, 8 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index b27d58956..b429e5617 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2187,10 +2187,9 @@ def check_required_use(required_use, use, iuse_match):
if level > 0:
level -= 1
l = stack.pop()
- ignore = False
+ op = None
if stack[level]:
if stack[level][-1] in ("||", "^^"):
- ignore = True
op = stack[level].pop()
satisfied = is_satisfied(op, l)
stack[level].append(satisfied)
@@ -2198,13 +2197,12 @@ def check_required_use(required_use, use, iuse_match):
elif not isinstance(stack[level][-1], bool) and \
stack[level][-1][-1] == "?":
- if is_active(stack[level][-1][:-1]):
- op = stack[level].pop()
+ op = stack[level].pop()
+ if is_active(op[:-1]):
satisfied = is_satisfied(op, l)
stack[level].append(satisfied)
node._satisfied = satisfied
else:
- stack[level].pop()
node._satisfied = True
last_node = node._parent._children.pop()
if last_node is not node:
@@ -2212,12 +2210,13 @@ def check_required_use(required_use, use, iuse_match):
"node is not last child of parent")
node = node._parent
continue
- ignore = True
- if l and not ignore:
+ if op is None:
satisfied = False not in l
- stack[level].append(satisfied)
node._satisfied = satisfied
+ if l:
+ stack[level].append(satisfied)
+
if node._parent._operator not in ("||", "^^"):
last_node = node._parent._children.pop()
if last_node is not node:
diff --git a/pym/portage/tests/dep/testCheckRequiredUse.py b/pym/portage/tests/dep/testCheckRequiredUse.py
index c5a8f5304..a0e10b1e7 100644
--- a/pym/portage/tests/dep/testCheckRequiredUse.py
+++ b/pym/portage/tests/dep/testCheckRequiredUse.py
@@ -195,6 +195,11 @@ class TestCheckRequiredUse(TestCase):
"|| ( ( ( ( a ) ) ( ( ( b c ) ) ) ) )",
[""],
"a b c"
+ ),
+ (
+ "|| ( ( a ( ( ) ( ) ) ( ( ) ) ( b ( ) c ) ) )",
+ [""],
+ "a b c"
)
)
for required_use, use, expected in test_cases: