* [gentoo-commits] proj/portage:prefix commit in: pym/portage/dep/, pym/portage/tests/dep/
@ 2011-02-05 12:25 99% Fabian Groffen
0 siblings, 0 replies; 1+ results
From: Fabian Groffen @ 2011-02-05 12:25 UTC (permalink / raw
To: gentoo-commits
commit: 3791c8aa4cb242aa2b507b6bac368925aad067b1
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 4 21:07:52 2011 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Feb 4 21:07:52 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3791c8aa
REQUIRED_USE: fix parens display and test more
---
pym/portage/dep/__init__.py | 44 +++++++++++++++++-------
pym/portage/tests/dep/testCheckRequiredUse.py | 5 +++
2 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 62e96d2..b27d589 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1,5 +1,5 @@
# deps.py -- Portage dependency resolution functions
-# Copyright 2003-2010 Gentoo Foundation
+# Copyright 2003-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = [
@@ -2206,7 +2206,10 @@ def check_required_use(required_use, use, iuse_match):
else:
stack[level].pop()
node._satisfied = True
- node._parent._children.remove(node)
+ last_node = node._parent._children.pop()
+ if last_node is not node:
+ raise AssertionError(
+ "node is not last child of parent")
node = node._parent
continue
ignore = True
@@ -2216,20 +2219,28 @@ def check_required_use(required_use, use, iuse_match):
stack[level].append(satisfied)
node._satisfied = satisfied
if node._parent._operator not in ("||", "^^"):
- offset = node._parent._children.index(node)
- node._parent._children.pop(offset)
- for i, child in enumerate(node._children):
- node._parent._children.insert(offset + i, child)
+ last_node = node._parent._children.pop()
+ if last_node is not node:
+ raise AssertionError(
+ "node is not last child of parent")
+ for child in node._children:
+ node._parent._children.append(child)
if isinstance(child, _RequiredUseBranch):
child._parent = node._parent
node = node._parent
continue
if not node._children:
- node._parent._children.remove(node)
+ last_node = node._parent._children.pop()
+ if last_node is not node:
+ raise AssertionError(
+ "node is not last child of parent")
elif len(node._children) == 1:
- index = node._parent._children.index(node)
- node._parent._children[index] = node._children[0]
+ last_node = node._parent._children.pop()
+ if last_node is not node:
+ raise AssertionError(
+ "node is not last child of parent")
+ node._parent._children.append(node._children[0])
if isinstance(node._children[0], _RequiredUseBranch):
node._children[0]._parent = node._parent
node = node._children[0]
@@ -2238,10 +2249,10 @@ def check_required_use(required_use, use, iuse_match):
if isinstance(child, _RequiredUseBranch) and \
child._operator is None and \
len(child._children) == 1:
- node._children[index] = child._children[0]
- if isinstance(node._children[index],
- _RequiredUseBranch):
- node._children[index]._parent = node
+ child = child._children[0]
+ node._children[index] = child
+ if isinstance(child, _RequiredUseBranch):
+ child._parent = node
node = node._parent
else:
@@ -2277,6 +2288,13 @@ def check_required_use(required_use, use, iuse_match):
raise InvalidDependString(
_("malformed syntax: '%s'") % required_use)
+ if len(tree._children) == 1:
+ child = tree._children[0]
+ if isinstance(child, _RequiredUseBranch) and \
+ child._operator is None:
+ tree = child
+ tree._parent = None
+
tree._satisfied = False not in stack[0]
return tree
diff --git a/pym/portage/tests/dep/testCheckRequiredUse.py b/pym/portage/tests/dep/testCheckRequiredUse.py
index 332c5a5..c5a8f53 100644
--- a/pym/portage/tests/dep/testCheckRequiredUse.py
+++ b/pym/portage/tests/dep/testCheckRequiredUse.py
@@ -190,6 +190,11 @@ class TestCheckRequiredUse(TestCase):
"^^ ( ( a b c ) ( b c !d ) )",
["a", "b", "c", "d"],
""
+ ),
+ (
+ "|| ( ( ( ( a ) ) ( ( ( b c ) ) ) ) )",
+ [""],
+ "a b c"
)
)
for required_use, use, expected in test_cases:
^ permalink raw reply related [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2011-02-05 12:25 99% [gentoo-commits] proj/portage:prefix commit in: pym/portage/dep/, pym/portage/tests/dep/ Fabian Groffen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox