1 |
commit: 5dc4bb046b871088923313bce4b66bde3c8e2e80 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Feb 4 22:31:32 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Feb 5 00:30:54 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=5dc4bb04 |
7 |
|
8 |
check_required_use: clarify operator logic |
9 |
|
10 |
--- |
11 |
pym/portage/dep/__init__.py | 15 +++++++-------- |
12 |
pym/portage/tests/dep/testCheckRequiredUse.py | 5 +++++ |
13 |
2 files changed, 12 insertions(+), 8 deletions(-) |
14 |
|
15 |
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py |
16 |
index b27d589..b429e56 100644 |
17 |
--- a/pym/portage/dep/__init__.py |
18 |
+++ b/pym/portage/dep/__init__.py |
19 |
@@ -2187,10 +2187,9 @@ def check_required_use(required_use, use, iuse_match): |
20 |
if level > 0: |
21 |
level -= 1 |
22 |
l = stack.pop() |
23 |
- ignore = False |
24 |
+ op = None |
25 |
if stack[level]: |
26 |
if stack[level][-1] in ("||", "^^"): |
27 |
- ignore = True |
28 |
op = stack[level].pop() |
29 |
satisfied = is_satisfied(op, l) |
30 |
stack[level].append(satisfied) |
31 |
@@ -2198,13 +2197,12 @@ def check_required_use(required_use, use, iuse_match): |
32 |
|
33 |
elif not isinstance(stack[level][-1], bool) and \ |
34 |
stack[level][-1][-1] == "?": |
35 |
- if is_active(stack[level][-1][:-1]): |
36 |
- op = stack[level].pop() |
37 |
+ op = stack[level].pop() |
38 |
+ if is_active(op[:-1]): |
39 |
satisfied = is_satisfied(op, l) |
40 |
stack[level].append(satisfied) |
41 |
node._satisfied = satisfied |
42 |
else: |
43 |
- stack[level].pop() |
44 |
node._satisfied = True |
45 |
last_node = node._parent._children.pop() |
46 |
if last_node is not node: |
47 |
@@ -2212,12 +2210,13 @@ def check_required_use(required_use, use, iuse_match): |
48 |
"node is not last child of parent") |
49 |
node = node._parent |
50 |
continue |
51 |
- ignore = True |
52 |
|
53 |
- if l and not ignore: |
54 |
+ if op is None: |
55 |
satisfied = False not in l |
56 |
- stack[level].append(satisfied) |
57 |
node._satisfied = satisfied |
58 |
+ if l: |
59 |
+ stack[level].append(satisfied) |
60 |
+ |
61 |
if node._parent._operator not in ("||", "^^"): |
62 |
last_node = node._parent._children.pop() |
63 |
if last_node is not node: |
64 |
|
65 |
diff --git a/pym/portage/tests/dep/testCheckRequiredUse.py b/pym/portage/tests/dep/testCheckRequiredUse.py |
66 |
index c5a8f53..a0e10b1 100644 |
67 |
--- a/pym/portage/tests/dep/testCheckRequiredUse.py |
68 |
+++ b/pym/portage/tests/dep/testCheckRequiredUse.py |
69 |
@@ -195,6 +195,11 @@ class TestCheckRequiredUse(TestCase): |
70 |
"|| ( ( ( ( a ) ) ( ( ( b c ) ) ) ) )", |
71 |
[""], |
72 |
"a b c" |
73 |
+ ), |
74 |
+ ( |
75 |
+ "|| ( ( a ( ( ) ( ) ) ( ( ) ) ( b ( ) c ) ) )", |
76 |
+ [""], |
77 |
+ "a b c" |
78 |
) |
79 |
) |
80 |
for required_use, use, expected in test_cases: |