From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/pkgcorepm/, gentoopm/paludispm/, gentoopm/basepm/
Date: Thu, 28 Jul 2011 16:24:01 +0000 (UTC) [thread overview]
Message-ID: <9d4789c7871d2c52b67fc304b5795d0ee60d985c.mgorny@gentoo> (raw)
commit: 9d4789c7871d2c52b67fc304b5795d0ee60d985c
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 28 16:24:54 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 28 16:24:54 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=9d4789c7
Fix matching blockers.
---
gentoopm/basepm/atom.py | 7 +++++--
gentoopm/paludispm/atom.py | 5 ++++-
gentoopm/pkgcorepm/atom.py | 2 +-
gentoopm/portagepm/atom.py | 9 ++++++---
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/gentoopm/basepm/atom.py b/gentoopm/basepm/atom.py
index e745a38..368b72a 100644
--- a/gentoopm/basepm/atom.py
+++ b/gentoopm/basepm/atom.py
@@ -115,8 +115,11 @@ class PMAtom(ABCObject, StringifiedComparisons):
@abstractmethod
def __contains__(self, pkg):
"""
- Check whether a package matches the atom (is contained in the set
- of packages matched by atom).
+ Check whether a package is contained in the set of packages matched
+ by the atom.
+
+ Please note that with blockers, this function returns C{True} for all
+ atoms not blocked by the atom.
@param pkg: a package to match
@type pkg: L{PMPackage}
diff --git a/gentoopm/paludispm/atom.py b/gentoopm/paludispm/atom.py
index ec5b830..60b4b05 100644
--- a/gentoopm/paludispm/atom.py
+++ b/gentoopm/paludispm/atom.py
@@ -83,7 +83,7 @@ class PaludisAtom(PMAtom):
self._incomplete = True
self._env = env
- def __contains__(self, pkg):
+ def _match(self, pkg):
# we have to implementing matching by hand, boo
other = pkg.atom
# 1) category, our may be unset
@@ -112,6 +112,9 @@ class PaludisAtom(PMAtom):
return False
return True
+ def __contains__(self, pkg):
+ return self._match(pkg) != self.blocking
+
def __str__(self):
if self._incomplete:
raise ValueError('Unable to stringify incomplete atom')
diff --git a/gentoopm/pkgcorepm/atom.py b/gentoopm/pkgcorepm/atom.py
index ac0a350..5eced44 100644
--- a/gentoopm/pkgcorepm/atom.py
+++ b/gentoopm/pkgcorepm/atom.py
@@ -104,7 +104,7 @@ class PkgCoreAtom(PMAtom):
raise InvalidAtomStringError('Incorrect atom: %s' % s)
def __contains__(self, pkg):
- return self._r.match(pkg._pkg)
+ return self._r.match(pkg._pkg) != self.blocking
def __str__(self):
if self.complete:
diff --git a/gentoopm/portagepm/atom.py b/gentoopm/portagepm/atom.py
index 425fd1e..9130d6a 100644
--- a/gentoopm/portagepm/atom.py
+++ b/gentoopm/portagepm/atom.py
@@ -78,13 +78,16 @@ class CompletePortageAtom(PMAtom):
def __init__(self, a):
self._atom = a
- def __contains__(self, pkg):
+ def _match(self, pkg):
# SLOT matching requires metadata so delay it.
- if not match_from_list(self._atom, [pkg.id]):
+ if not match_from_list(self._atom, [pkg._cpv]):
return False
return not self._atom.slot \
or self._atom.slot == pkg.metadata.SLOT
+ def __contains__(self, pkg):
+ return self._match(pkg) != self.blocking
+
def __str__(self):
return str(self._atom)
@@ -94,7 +97,7 @@ class CompletePortageAtom(PMAtom):
@property
def blocking(self):
- return self._atom.blocker
+ return bool(self._atom.blocker)
@property
def key(self):
next reply other threads:[~2011-07-28 16:24 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-28 16:24 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-09-16 7:39 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/pkgcorepm/, gentoopm/paludispm/, gentoopm/basepm/ Michał Górny
2011-08-15 9:01 Michał Górny
2011-08-15 8:48 Michał Górny
2011-08-15 7:57 Michał Górny
2011-08-14 14:22 Michał Górny
2011-08-12 8:24 Michał Górny
2011-08-01 17:14 Michał Górny
2011-07-30 18:39 Michał Górny
2011-07-30 8:13 Michał Górny
2011-07-28 19:54 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-27 21:32 Michał Górny
2011-07-27 16:24 Michał Górny
2011-07-27 16:24 Michał Górny
2011-07-23 9:27 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-20 18:02 Michał Górny
2011-07-20 9:41 Michał Górny
2011-07-19 11:53 Michał Górny
2011-07-18 17:54 Michał Górny
2011-07-18 14:40 Michał Górny
2011-07-15 22:24 Michał Górny
2011-07-15 22:24 Michał Górny
2011-07-14 14:05 Michał Górny
2011-07-14 13:31 Michał Górny
2011-07-14 13:31 Michał Górny
2011-07-14 12:19 Michał Górny
2011-07-13 16:09 Michał Górny
2011-07-13 16:09 Michał Górny
2011-07-12 8:31 Michał Górny
2011-07-07 12:52 Michał Górny
2011-07-07 9:51 Michał Górny
2011-07-06 20:54 Michał Górny
2011-07-06 16:03 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=9d4789c7871d2c52b67fc304b5795d0ee60d985c.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