From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
Date: Sun, 10 Jul 2011 22:17:27 +0000 (UTC) [thread overview]
Message-ID: <dc6dbc7c57f9ce4f3bed0b88b17d59521ec98043.mgorny@gentoo> (raw)
commit: dc6dbc7c57f9ce4f3bed0b88b17d59521ec98043
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 22:13:10 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 22:17:02 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=dc6dbc7c
pkgcore: transform strings to atoms in filter().
---
gentoopm/pkgcorepm/filter.py | 2 ++
gentoopm/pkgcorepm/pkg.py | 13 ++++++++++++-
gentoopm/pkgcorepm/repo.py | 9 +++++----
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/gentoopm/pkgcorepm/filter.py b/gentoopm/pkgcorepm/filter.py
index 6201637..d7218b7 100644
--- a/gentoopm/pkgcorepm/filter.py
+++ b/gentoopm/pkgcorepm/filter.py
@@ -21,6 +21,8 @@ def transform_filters(args, kwargs):
f = []
for a in args:
+ if isinstance(a, basestring):
+ a = PkgCoreAtom(a)
if isinstance(a, PkgCoreAtom):
f.append(a._r)
else:
diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index 220473f..8e344d0 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -4,7 +4,18 @@
# Released under the terms of the 2-clause BSD license.
from gentoopm.basepm.metadata import PMPackageMetadata
-from gentoopm.basepm.pkg import PMPackage
+from gentoopm.basepm.pkg import PMPackage, PMPackageSet, PMFilteredPackageSet
+from gentoopm.pkgcorepm.atom import PkgCoreAtom
+
+class PkgCorePackageSet(PMPackageSet):
+ def filter(self, *args, **kwargs):
+ newargs = [(a if not isinstance(a, basestring)
+ else PkgCoreAtom(a)) for a in args]
+
+ return PkgCoreFilteredPackageSet(self, newargs, kwargs)
+
+class PkgCoreFilteredPackageSet(PkgCorePackageSet, PMFilteredPackageSet):
+ pass
class PkgCorePackage(PMPackage):
def __init__(self, pkg, repo_index = 0):
diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index cd25359..c76d3c6 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -7,7 +7,8 @@ import pkgcore.restrictions.boolean as br
from gentoopm.basepm.repo import PMRepository, PMRepositoryDict, \
PMEbuildRepository
-from gentoopm.pkgcorepm.pkg import PkgCorePackage
+from gentoopm.pkgcorepm.pkg import PkgCorePackage, PkgCorePackageSet, \
+ PkgCoreFilteredPackageSet
from gentoopm.pkgcorepm.filter import transform_filters
class PkgCoreRepoDict(PMRepositoryDict):
@@ -18,7 +19,7 @@ class PkgCoreRepoDict(PMRepositoryDict):
def __init__(self, stack):
self._stack = stack
-class PkgCoreRepository(PMRepository):
+class PkgCoreRepository(PkgCorePackageSet, PMRepository):
_index = 0
def __init__(self, repo_obj):
self._repo = repo_obj
@@ -35,7 +36,7 @@ class PkgCoreRepository(PMRepository):
if filt:
r = PkgCoreFilteredRepo(self, filt)
if newargs or newkwargs:
- r = PMRepository.filter(r, *args, **kwargs)
+ r = PkgCoreFilteredPackageSet(r, args, kwargs)
return r
@@ -58,7 +59,7 @@ class PkgCoreFilteredRepo(PkgCoreRepository):
r = PkgCoreFilteredRepo(self._repo,
br.AndRestriction(self._filt, filt))
if newargs or newkwargs:
- r = PMRepository.filter(r, *args, **kwargs)
+ r = PkgCoreFilteredPackageSet(r, args, kwargs)
return r
next reply other threads:[~2011-07-10 22:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-10 22:17 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-10-14 21:35 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/ Michał Górny
2011-11-14 22:12 Michał Górny
2011-11-14 21:44 Michał Górny
2011-11-14 21:44 Michał Górny
2011-08-13 18:49 Michał Górny
2011-07-27 20:45 Michał Górny
2011-07-26 16:36 Michał Górny
2011-07-26 7:24 Michał Górny
2011-07-25 19:06 Michał Górny
2011-07-25 19:06 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-15 13:32 Michał Górny
2011-07-15 12:34 Michał Górny
2011-07-14 13:31 Michał Górny
2011-07-13 17:16 Michał Górny
2011-07-13 17:05 Michał Górny
2011-07-12 9:14 Michał Górny
2011-07-09 7:15 Michał Górny
2011-07-09 7:15 Michał Górny
2011-07-09 7:15 Michał Górny
2011-07-08 7:18 Michał Górny
2011-07-07 9:51 Michał Górny
2011-07-06 20:54 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dc6dbc7c57f9ce4f3bed0b88b17d59521ec98043.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox