From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dep/, pym/portage/tests/dep/
Date: Fri, 4 Feb 2011 21:41:54 +0000 (UTC) [thread overview]
Message-ID: <f465f3a21c4e814885d53ce29c7e6e4ab38db16f.zmedico@gentoo> (raw)
commit: f465f3a21c4e814885d53ce29c7e6e4ab38db16f
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 4 21:07:52 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Feb 4 21:41:34 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f465f3a2
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:
next reply other threads:[~2011-02-04 21:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 21:41 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-02-08 0:54 [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dep/, pym/portage/tests/dep/ Zac Medico
2011-02-05 0:59 Zac Medico
2011-02-05 0:59 Zac Medico
2011-02-04 6:07 zmedico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f465f3a21c4e814885d53ce29c7e6e4ab38db16f.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox