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 1QfRlT-0008Uo-DN for garchives@archives.gentoo.org; Sat, 09 Jul 2011 07:15:47 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3A73121C045; Sat, 9 Jul 2011 07:15:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 0716D21C036 for ; Sat, 9 Jul 2011 07:15:39 +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 7372C2AC10B for ; Sat, 9 Jul 2011 07:15:39 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C20D58003F for ; Sat, 9 Jul 2011 07:15:38 +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: Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/ X-VCS-Repository: proj/gentoopm X-VCS-Files: gentoopm/pkgcorepm/filter.py gentoopm/pkgcorepm/repo.py X-VCS-Directories: gentoopm/pkgcorepm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: af8c9393c0859f41ca3a3cca72b269bbb7d93bfd Date: Sat, 9 Jul 2011 07:15: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: 746b0b43461be55e64ce3a03ae462e46 commit: af8c9393c0859f41ca3a3cca72b269bbb7d93bfd Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Sat Jul 9 07:11:26 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Sat Jul 9 07:12:30 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoopm.git;= a=3Dcommit;h=3Daf8c9393 pkgcore: support transforming atom restrictions. --- gentoopm/pkgcorepm/filter.py | 22 +++++++++++++++++++++- gentoopm/pkgcorepm/repo.py | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gentoopm/pkgcorepm/filter.py b/gentoopm/pkgcorepm/filter.py index ad9aeca..6201637 100644 --- a/gentoopm/pkgcorepm/filter.py +++ b/gentoopm/pkgcorepm/filter.py @@ -3,6 +3,10 @@ # (c) 2011 Micha=C5=82 G=C3=B3rny # Released under the terms of the 2-clause BSD license. =20 +import pkgcore.restrictions.boolean as br + +from gentoopm.pkgcorepm.atom import PkgCoreAtom + def transform_filters(args, kwargs): """ Transform our filters into pkgcore restrictions whenever possible. Take= s @@ -13,4 +17,20 @@ def transform_filters(args, kwargs): and args & kwargs are returned unmodified. """ =20 - return (None, args, kwargs) + newargs =3D [] + f =3D [] + + for a in args: + if isinstance(a, PkgCoreAtom): + f.append(a._r) + else: + newargs.append(a) + + if not f: + f =3D None + elif len(f) =3D=3D 1: + f =3D f[0] + else: + f =3D br.AndRestriction(*f) + + return (f, newargs, kwargs) diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py index 0a63cab..c923c69 100644 --- a/gentoopm/pkgcorepm/repo.py +++ b/gentoopm/pkgcorepm/repo.py @@ -45,7 +45,7 @@ class PkgCoreFilteredRepo(PkgCoreRepository): =20 def __iter__(self): index =3D self._index - for pkg in self._repo.matches(self._filt): + for pkg in self._repo._repo.match(self._filt): yield PkgCorePackage(pkg, index) =20 class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository):