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 1PlSs6-0004su-IJ for garchives@archives.gentoo.org; Fri, 04 Feb 2011 21:07:14 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1C6EBE09BA; Fri, 4 Feb 2011 21:07:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CC594E09BA for ; Fri, 4 Feb 2011 21:07:06 +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 261C31B4120 for ; Fri, 4 Feb 2011 21:07:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 51A028006D for ; Fri, 4 Feb 2011 21:07:05 +0000 (UTC) To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <3791c8aa4cb242aa2b507b6bac368925aad067b1.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master 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: 3791c8aa4cb242aa2b507b6bac368925aad067b1 Date: Fri, 4 Feb 2011 21:07:05 +0000 (UTC) From: zmedico@gentoo.org 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: 5a36d1b87168c096b6248a6c12bcc3c0 commit: 3791c8aa4cb242aa2b507b6bac368925aad067b1 Author: Zac Medico gentoo org> AuthorDate: Fri Feb 4 21:07:52 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Feb 4 21:07:52 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D3791c8aa REQUIRED_USE: fix parens display and test more --- pym/portage/dep/__init__.py | 44 +++++++++++++++++--= ----- pym/portage/tests/dep/testCheckRequiredUse.py | 5 +++ 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 62e96d2..b27d589 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -1,5 +1,5 @@ # deps.py -- Portage dependency resolution functions -# Copyright 2003-2010 Gentoo Foundation +# Copyright 2003-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 __all__ =3D [ @@ -2206,7 +2206,10 @@ def check_required_use(required_use, use, iuse_mat= ch): else: stack[level].pop() node._satisfied =3D True - node._parent._children.remove(node) + last_node =3D node._parent._children.pop() + if last_node is not node: + raise AssertionError( + "node is not last child of parent") node =3D node._parent continue ignore =3D True @@ -2216,20 +2219,28 @@ def check_required_use(required_use, use, iuse_ma= tch): stack[level].append(satisfied) node._satisfied =3D satisfied if node._parent._operator not in ("||", "^^"): - offset =3D node._parent._children.index(node) - node._parent._children.pop(offset) - for i, child in enumerate(node._children): - node._parent._children.insert(offset + i, child) + 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 node =3D node._parent continue =20 if not node._children: - node._parent._children.remove(node) + last_node =3D node._parent._children.pop() + if last_node is not node: + raise AssertionError( + "node is not last child of parent") elif len(node._children) =3D=3D 1: - index =3D node._parent._children.index(node) - node._parent._children[index] =3D node._children[0] + last_node =3D node._parent._children.pop() + if last_node is not node: + raise AssertionError( + "node is not last child of parent") + node._parent._children.append(node._children[0]) if isinstance(node._children[0], _RequiredUseBranch): node._children[0]._parent =3D node._parent node =3D node._children[0] @@ -2238,10 +2249,10 @@ def check_required_use(required_use, use, iuse_ma= tch): if isinstance(child, _RequiredUseBranch) and \ child._operator is None and \ len(child._children) =3D=3D 1: - node._children[index] =3D child._children[0] - if isinstance(node._children[index], - _RequiredUseBranch): - node._children[index]._parent =3D node + child =3D child._children[0] + node._children[index] =3D child + if isinstance(child, _RequiredUseBranch): + child._parent =3D node =20 node =3D node._parent else: @@ -2277,6 +2288,13 @@ 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 332c5a5..c5a8f53 100644 --- a/pym/portage/tests/dep/testCheckRequiredUse.py +++ b/pym/portage/tests/dep/testCheckRequiredUse.py @@ -190,6 +190,11 @@ class TestCheckRequiredUse(TestCase): "^^ ( ( a b c ) ( b c !d ) )", ["a", "b", "c", "d"], "" + ), + ( + "|| ( ( ( ( a ) ) ( ( ( b c ) ) ) ) )", + [""], + "a b c" ) ) for required_use, use, expected in test_cases: