From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:prefix commit in: pym/portage/dep/, pym/portage/tests/dep/
Date: Sat, 5 Feb 2011 12:25:03 +0000 (UTC) [thread overview]
Message-ID: <644eb3fe5455c12bd1f831812bb17ae582acb3bc.grobian@gentoo> (raw)
commit: 644eb3fe5455c12bd1f831812bb17ae582acb3bc
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 4 01:38:32 2011 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Feb 4 01:38:32 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=644eb3fe
REQUIRED_USE: fix parens display and test
---
pym/portage/dep/__init__.py | 7 ++++-
pym/portage/tests/dep/testCheckRequiredUse.py | 32 ++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 7e9a18a..0300b74 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -2088,11 +2088,14 @@ 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)
tokens = []
if self._operator is not None:
tokens.append(self._operator)
- if self._parent is not None:
+ if include_parens:
tokens.append("(")
complex_nesting = False
@@ -2111,7 +2114,7 @@ class _RequiredUseBranch(object):
if not child._satisfied:
tokens.append(child.tounicode())
- if self._parent is not None:
+ if include_parens:
tokens.append(")")
return " ".join(tokens)
diff --git a/pym/portage/tests/dep/testCheckRequiredUse.py b/pym/portage/tests/dep/testCheckRequiredUse.py
index 0f7a299..0fb9702 100644
--- a/pym/portage/tests/dep/testCheckRequiredUse.py
+++ b/pym/portage/tests/dep/testCheckRequiredUse.py
@@ -134,7 +134,37 @@ class TestCheckRequiredUse(TestCase):
(
"^^ ( || ( ( a b ) ) ( c ) )",
("a", "b", "c"),
- "^^ ( || ( ( a b ) ) ( c ) )"
+ "^^ ( || ( a b ) c )"
+ ),
+ (
+ "a? ( ( c e ) ( b d ) )",
+ ("a", "c", "e"),
+ "a? ( b d )"
+ ),
+ (
+ "a? ( ( c e ) ( b d ) )",
+ ("a", "b", "c", "e"),
+ "a? ( d )"
+ ),
+ (
+ "^^ ( || ( a b ) ^^ ( b c ) )",
+ ("a", "b"),
+ "^^ ( || ( a b ) ^^ ( b c ) )"
+ ),
+ (
+ "^^ ( || ( a b ) ^^ ( b c ) )",
+ ["a", "c"],
+ "^^ ( || ( a b ) ^^ ( b c ) )"
+ ),
+ (
+ "^^ ( || ( a b ) ^^ ( b c ) )",
+ ["b", "c"],
+ ""
+ ),
+ (
+ "^^ ( || ( a b ) ^^ ( b c ) )",
+ ["a", "b", "c"],
+ ""
)
)
for required_use, use, expected in test_cases:
next reply other threads:[~2011-02-05 20:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-05 12:25 Fabian Groffen [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-02-05 12:25 [gentoo-commits] proj/portage:prefix commit in: pym/portage/dep/, pym/portage/tests/dep/ Fabian Groffen
2011-02-05 12:25 Fabian Groffen
2011-02-05 12:25 Fabian Groffen
2011-02-05 12:25 Fabian Groffen
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=644eb3fe5455c12bd1f831812bb17ae582acb3bc.grobian@gentoo \
--to=grobian@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