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 1PlkcO-0000Fd-7N for garchives@archives.gentoo.org; Sat, 05 Feb 2011 16:04:12 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F02D0E09C0; Sat, 5 Feb 2011 16:04:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B27A0E09C0 for ; Sat, 5 Feb 2011 16:04:04 +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 1F3D41B4142 for ; Sat, 5 Feb 2011 16:04:04 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 335EB800AD for ; Sat, 5 Feb 2011 12:25:07 +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: <6c9cbe5ab35ba4fd666924fbac4ad63d8f820719.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: 6c9cbe5ab35ba4fd666924fbac4ad63d8f820719 Date: Sat, 5 Feb 2011 12:25:07 +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: 58a5ec8195f11312a9764f276026ccb4 commit: 6c9cbe5ab35ba4fd666924fbac4ad63d8f820719 Author: Zac Medico gentoo org> AuthorDate: Sat Feb 5 00:16:15 2011 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat Feb 5 00:16:15 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D6c9cbe5a REQUIRED_USE: fix parens display and test more --- pym/portage/dep/__init__.py | 21 ++++++++++++-------= -- pym/portage/tests/dep/testCheckRequiredUse.py | 12 +++++++++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 6b125f0..571f6c1 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -2217,7 +2217,8 @@ def check_required_use(required_use, use, iuse_matc= h): if l: stack[level].append(satisfied) =20 - if node._parent._operator not in ("||", "^^"): + if len(node._children) <=3D 1 or \ + node._parent._operator not in ("||", "^^"): last_node =3D node._parent._children.pop() if last_node is not node: raise AssertionError( @@ -2242,7 +2243,16 @@ def check_required_use(required_use, use, iuse_mat= ch): if isinstance(node._children[0], _RequiredUseBranch): node._children[0]._parent =3D node._parent node =3D node._children[0] - + if node._operator is None and \ + node._parent._operator not in ("||", "^^"): + last_node =3D 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 =3D node._parent else: for index, child in enumerate(node._children): if isinstance(child, _RequiredUseBranch) and \ @@ -2287,13 +2297,6 @@ def check_required_use(required_use, use, iuse_mat= ch): raise InvalidDependString( _("malformed syntax: '%s'") % required_use) =20 - if len(tree._children) =3D=3D 1: - child =3D tree._children[0] - if isinstance(child, _RequiredUseBranch) and \ - child._operator is None: - tree =3D child - tree._parent =3D None - tree._satisfied =3D False not in stack[0] return tree =20 diff --git a/pym/portage/tests/dep/testCheckRequiredUse.py b/pym/portage/= tests/dep/testCheckRequiredUse.py index a0e10b1..54791e0 100644 --- a/pym/portage/tests/dep/testCheckRequiredUse.py +++ b/pym/portage/tests/dep/testCheckRequiredUse.py @@ -192,6 +192,11 @@ class TestCheckRequiredUse(TestCase): "" ), ( + "( ( ( a ) ) ( ( ( b c ) ) ) )", + [""], + "a b c" + ), + ( "|| ( ( ( ( a ) ) ( ( ( b c ) ) ) ) )", [""], "a b c" @@ -200,7 +205,12 @@ class TestCheckRequiredUse(TestCase): "|| ( ( a ( ( ) ( ) ) ( ( ) ) ( b ( ) c ) ) )", [""], "a b c" - ) + ), + ( + "|| ( ( a b c ) ) || ( ( d e f ) )", + [""], + "a b c d e f" + ), ) for required_use, use, expected in test_cases: result =3D check_required_use(required_use, use, lambda k: True).toun= icode()