From: 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 06:07:50 +0000 (UTC) [thread overview]
Message-ID: <99e44795c9fcbdd9c5630b9b8fe0ebff8322fd68.zmedico@gentoo> (raw)
commit: 99e44795c9fcbdd9c5630b9b8fe0ebff8322fd68
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 4 05:42:18 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Feb 4 06:07:33 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=99e44795c9fcbdd9c5630b9b8fe0ebff8322fd68
REQUIRED_USE: fix parens display and test more
---
pym/portage/dep/__init__.py | 35 ++++++++++++++++++++++--
pym/portage/tests/dep/testCheckRequiredUse.py | 17 +++++++++++-
2 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 0300b74..68e628b 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2088,9 +2088,7 @@ class _RequiredUseBranch(object):
def tounicode(self):
- include_parens = self._parent is not None and \
- (self._operator is not None or \
- self._parent._operator is None)
+ include_parens = self._parent is not None
tokens = []
if self._operator is not None:
tokens.append(self._operator)
@@ -2197,6 +2195,7 @@ def check_required_use(required_use, use, iuse_match):
satisfied = is_satisfied(op, l)
stack[level].append(satisfied)
node._satisfied = satisfied
+
elif not isinstance(stack[level][-1], bool) and \
stack[level][-1][-1] == "?":
if is_active(stack[level][-1][:-1]):
@@ -2207,12 +2206,42 @@ def check_required_use(required_use, use, iuse_match):
else:
stack[level].pop()
node._satisfied = True
+ node._parent._children.remove(node)
+ node = node._parent
+ continue
ignore = True
if l and not ignore:
satisfied = False not in l
stack[level].append(satisfied)
node._satisfied = satisfied
+ if node._parent._operator not in ("||", "^^"):
+ offset = node._parent._children.index(node)
+ node._parent._children.remove(node)
+ for i, child in enumerate(node._children):
+ node._parent._children.insert(offset + i, child)
+ if isinstance(child, _RequiredUseBranch):
+ child._parent = node._parent
+ node = node._parent
+ continue
+
+ if not node._children:
+ node._parent._children.remove(node)
+ elif len(node._children) == 1:
+ index = node._parent._children.index(node)
+ node._parent._children[index] = node._children[0]
+ if isinstance(node._children[0], _RequiredUseBranch):
+ node._children[0]._parent = node._parent
+ node = node._children[0]
+ else:
+ for index, child in enumerate(node._children):
+ 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
node = node._parent
else:
diff --git a/pym/portage/tests/dep/testCheckRequiredUse.py b/pym/portage/tests/dep/testCheckRequiredUse.py
index 0fb9702..d6a9d0c 100644
--- a/pym/portage/tests/dep/testCheckRequiredUse.py
+++ b/pym/portage/tests/dep/testCheckRequiredUse.py
@@ -134,7 +134,7 @@ class TestCheckRequiredUse(TestCase):
(
"^^ ( || ( ( a b ) ) ( c ) )",
("a", "b", "c"),
- "^^ ( || ( a b ) c )"
+ "^^ ( ( a b ) c )"
),
(
"a? ( ( c e ) ( b d ) )",
@@ -147,6 +147,11 @@ class TestCheckRequiredUse(TestCase):
"a? ( d )"
),
(
+ "a? ( ( c e ) ( c e b c d e c ) )",
+ ("a", "c", "e"),
+ "a? ( b d )"
+ ),
+ (
"^^ ( || ( a b ) ^^ ( b c ) )",
("a", "b"),
"^^ ( || ( a b ) ^^ ( b c ) )"
@@ -165,6 +170,16 @@ class TestCheckRequiredUse(TestCase):
"^^ ( || ( a b ) ^^ ( b c ) )",
["a", "b", "c"],
""
+ ),
+ (
+ "^^ ( ( a b c ) ( b c d ) )",
+ ["a", "b", "c"],
+ ""
+ ),
+ (
+ "^^ ( ( a b c ) ( b c d ) )",
+ ["a", "b", "c", "d"],
+ "^^ ( ( a b c ) ( b c d ) )"
)
)
for required_use, use, expected in test_cases:
next reply other threads:[~2011-02-04 6:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-04 6:07 zmedico [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-02-04 21:41 [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-08 0:54 Zac Medico
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=99e44795c9fcbdd9c5630b9b8fe0ebff8322fd68.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