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 1Qlc03-0007US-Jy for garchives@archives.gentoo.org; Tue, 26 Jul 2011 07:24:19 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 55F6F21C131; Tue, 26 Jul 2011 07:24:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 2716721C131 for ; Tue, 26 Jul 2011 07:24:12 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A805E1BC022 for ; Tue, 26 Jul 2011 07:24:11 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 71AF680042 for ; Tue, 26 Jul 2011 07:24:10 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <38f9d3fda6203bf31a2fb5e12fcc7cfc3c840a71.mgorny@gentoo> Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/ X-VCS-Repository: proj/gentoopm X-VCS-Files: gentoopm/pkgcorepm/depend.py X-VCS-Directories: gentoopm/pkgcorepm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 38f9d3fda6203bf31a2fb5e12fcc7cfc3c840a71 Date: Tue, 26 Jul 2011 07:24:10 +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: faa0159edb92a12ae13a6f5f0248f5f9 commit: 38f9d3fda6203bf31a2fb5e12fcc7cfc3c840a71 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Tue Jul 26 07:24:37 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Tue Jul 26 07:24:37 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoopm.git;= a=3Dcommit;h=3D38f9d3fd pkgcore: support dropping conditionals using evaluate_depset(). --- gentoopm/pkgcorepm/depend.py | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/gentoopm/pkgcorepm/depend.py b/gentoopm/pkgcorepm/depend.py index 5c38500..eaa6333 100644 --- a/gentoopm/pkgcorepm/depend.py +++ b/gentoopm/pkgcorepm/depend.py @@ -37,4 +37,31 @@ class PkgCoreConditionalUseDep(PMConditionalDep, PkgCo= reBaseDep): return self._deps.restriction.match(self._pkg.use) =20 class PkgCorePackageDepSet(PMPackageDepSet, PkgCoreBaseDep): + @property + def without_conditionals(self): + return PkgCoreUncondPackageDepSet( + self._deps.evaluate_depset(self._pkg.use)) + +class PkgCoreUncondDep(PkgCoreBaseDep): + def __init__(self, deps): + self._deps =3D deps + + @property + def without_conditionals(self): + return self + + def __iter__(self): + for d in self._deps: + if isinstance(d, atom): + yield PkgCoreAtom(d) + elif isinstance(d, OrRestriction): + yield PkgCoreUncondOneOfDep(d) + else: + raise NotImplementedError('Parsing %s not implemented' \ + % repr(d)) + +class PkgCoreUncondOneOfDep(PMOneOfDep, PkgCoreUncondDep): + pass + +class PkgCoreUncondPackageDepSet(PkgCoreUncondDep): pass