From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Plp65-0003lM-Fl for garchives@archives.gentoo.org; Sat, 05 Feb 2011 20:51:09 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BBAE71C09A; Sat, 5 Feb 2011 20:51:01 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8313C1C09A for ; Sat, 5 Feb 2011 20:51:01 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id DC1351B40B2 for ; Sat, 5 Feb 2011 20:51:00 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C1ECD8006E for ; Sat, 5 Feb 2011 12:25:03 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <644eb3fe5455c12bd1f831812bb17ae582acb3bc.grobian@gentoo> Subject: [gentoo-commits] proj/portage:prefix commit in: pym/portage/dep/, pym/portage/tests/dep/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dep/__init__.py pym/portage/tests/dep/testCheckRequiredUse.py X-VCS-Directories: pym/portage/dep/ pym/portage/tests/dep/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 644eb3fe5455c12bd1f831812bb17ae582acb3bc Date: Sat, 5 Feb 2011 12:25:03 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 4ea78b357311df972d7d61b3f1ebdb31 commit: 644eb3fe5455c12bd1f831812bb17ae582acb3bc Author: Zac Medico gentoo org> AuthorDate: Fri Feb 4 01:38:32 2011 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Fri Feb 4 01:38:32 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D644eb3fe 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): =20 def tounicode(self): =20 + include_parens =3D self._parent is not None and \ + (self._operator is not None or \ + self._parent._operator is None) tokens =3D [] if self._operator is not None: tokens.append(self._operator) =20 - if self._parent is not None: + if include_parens: tokens.append("(") =20 complex_nesting =3D False @@ -2111,7 +2114,7 @@ class _RequiredUseBranch(object): if not child._satisfied: tokens.append(child.tounicode()) =20 - if self._parent is not None: + if include_parens: tokens.append(")") =20 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: