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 1PlWeG-0006HQ-8X for garchives@archives.gentoo.org; Sat, 05 Feb 2011 01:09:17 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D954FE0856; Sat, 5 Feb 2011 01:09:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 9D239E0856 for ; Sat, 5 Feb 2011 01:09: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 0DE2F1B4009 for ; Sat, 5 Feb 2011 01:09:04 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 2475280074 for ; Sat, 5 Feb 2011 00:59:38 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:2.1.9 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: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: b88dde55fae635e4d43634acb62711d8435fcd42 Date: Sat, 5 Feb 2011 00:59:38 +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: c77393d9b9bdbb977990fc71c4cf1202 commit: b88dde55fae635e4d43634acb62711d8435fcd42 Author: Zac Medico gentoo org> AuthorDate: Sat Feb 5 00:16:15 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Feb 5 00:31:08 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Db88dde55 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()