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 1QmWfX-0004y9-Rn for garchives@archives.gentoo.org; Thu, 28 Jul 2011 19:54:56 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0161021C15D; Thu, 28 Jul 2011 19:54:47 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B616921C15D for ; Thu, 28 Jul 2011 19:54:47 +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 1CC721B401A for ; Thu, 28 Jul 2011 19:54:47 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 752638003D for ; Thu, 28 Jul 2011 19:54:46 +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: <35ccdf9b9c1ccef8482e8d2f2ed1dac3d50849d6.mgorny@gentoo> Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/paludispm/ X-VCS-Repository: proj/gentoopm X-VCS-Files: gentoopm/paludispm/depend.py X-VCS-Directories: gentoopm/paludispm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 35ccdf9b9c1ccef8482e8d2f2ed1dac3d50849d6 Date: Thu, 28 Jul 2011 19:54:46 +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: fb52bfd67f88d6a1354ec2d9dd161459 commit: 35ccdf9b9c1ccef8482e8d2f2ed1dac3d50849d6 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Thu Jul 28 19:25:57 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Thu Jul 28 19:25:57 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoopm.git;= a=3Dcommit;h=3D35ccdf9b Paludis: support passing more args to depspecs. --- gentoopm/paludispm/depend.py | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gentoopm/paludispm/depend.py b/gentoopm/paludispm/depend.py index ee5ad4c..9084f3d 100644 --- a/gentoopm/paludispm/depend.py +++ b/gentoopm/paludispm/depend.py @@ -4,6 +4,7 @@ # Released under the terms of the 2-clause BSD license. =20 import paludis, re +from collections import namedtuple =20 from gentoopm.basepm.depend import PMPackageDepSet, PMConditionalDep, \ PMAnyOfDep, PMAllOfDep, PMExactlyOneOfDep, PMBaseDep @@ -12,25 +13,25 @@ from gentoopm.paludispm.atom import PaludisAtom _block_re =3D re.compile('^!*') =20 class PaludisBaseDep(PMBaseDep): - def __init__(self, deps, pkg): + def __init__(self, deps, args): self._deps =3D deps - self._pkg =3D pkg + self._args =3D args =20 def __iter__(self): for d in self._deps: if isinstance(d, paludis.PackageDepSpec): - yield PaludisAtom(d, self._pkg._env) + yield PaludisAtom(d, self._args.env) elif isinstance(d, paludis.BlockDepSpec): - yield PaludisAtom(d.blocking, self._pkg._env, + yield PaludisAtom(d.blocking, self._args.env, block =3D _block_re.match(d.text).group(0)) elif isinstance(d, paludis.AnyDepSpec): - yield PaludisAnyOfDep(d, self._pkg) + yield PaludisAnyOfDep(d, self._args) elif isinstance(d, paludis.AllDepSpec): - yield PaludisAllOfDep(d, self._pkg) + yield PaludisAllOfDep(d, self._args) elif isinstance(d, paludis.ExactlyOneDepSpec): - yield PaludisExactlyOneOfDep(d, self._pkg) + yield PaludisExactlyOneOfDep(d, self._args) elif isinstance(d, paludis.ConditionalDepSpec): - yield PaludisConditionalDep(d, self._pkg) + yield PaludisConditionalDep(d, self._args) elif isinstance(d, paludis.PlainTextDepSpec): # XXX: this is in REQUIRED_USE as well yield str(d) @@ -49,7 +50,10 @@ class PaludisExactlyOneOfDep(PMExactlyOneOfDep, Paludi= sBaseDep): class PaludisConditionalDep(PMConditionalDep, PaludisBaseDep): @property def enabled(self): - return self._deps.condition_met(self._pkg._env, self._pkg._pkg) + return self._deps.condition_met(self._args.env, self._args.pkg) + +_argtuple =3D namedtuple('PaludisDepArgTuple', ('env', 'pkg', 'cls')) =20 class PaludisPackageDepSet(PMPackageDepSet, PaludisAllOfDep): - pass + def __init__(self, deps, pkg, cls =3D None): + PaludisAllOfDep.__init__(self, deps, _argtuple(pkg._env, pkg._pkg, cls= ))