public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
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/
Date: Thu, 14 Jul 2011 07:32:41 +0000 (UTC)	[thread overview]
Message-ID: <73ec5c0c1a28d16f22c4d0cd292045511d85946f.mgorny@gentoo> (raw)

commit:     73ec5c0c1a28d16f22c4d0cd292045511d85946f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 14 07:33:23 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 14 07:33:23 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=73ec5c0c

Associate package-derived atoms with packages.

---
 gentoopm/paludispm/atom.py |    3 ++-
 gentoopm/paludispm/pkg.py  |    2 +-
 gentoopm/pkgcorepm/atom.py |    3 ++-
 gentoopm/pkgcorepm/pkg.py  |    2 +-
 gentoopm/portagepm/atom.py |    9 +++++----
 gentoopm/portagepm/pkg.py  |    2 +-
 6 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/gentoopm/paludispm/atom.py b/gentoopm/paludispm/atom.py
index 2b03d41..4674b77 100644
--- a/gentoopm/paludispm/atom.py
+++ b/gentoopm/paludispm/atom.py
@@ -25,7 +25,7 @@ class PaludisAtom(PMAtom):
 				paludis.RepositoryNameError):
 			raise InvalidAtomStringError('Incorrect atom: %s' % s)
 
-	def __init__(self, s, env):
+	def __init__(self, s, env, pkg = None):
 		try:
 			self._init_atom(s, env)
 		except InvalidAtomStringError:
@@ -34,6 +34,7 @@ class PaludisAtom(PMAtom):
 			self._incomplete = True
 		else:
 			self._incomplete = False
+		self._pkg = pkg
 
 	def __contains__(self, pkg):
 		raise NotImplementedError('Direct atom matching not implemented in Paludis')

diff --git a/gentoopm/paludispm/pkg.py b/gentoopm/paludispm/pkg.py
index 2ba12d8..5bb8123 100644
--- a/gentoopm/paludispm/pkg.py
+++ b/gentoopm/paludispm/pkg.py
@@ -67,7 +67,7 @@ class PaludisID(PMPackage):
 	@property
 	def atom(self):
 		# XXX: newer version wraps getting atom
-		return PaludisAtom('=%s' % self.id, self._env)
+		return PaludisAtom('=%s' % self.id, self._env, self)
 
 	def __cmp__(self, other):
 		if not isinstance(other, PaludisID):

diff --git a/gentoopm/pkgcorepm/atom.py b/gentoopm/pkgcorepm/atom.py
index 9eb59a6..a765403 100644
--- a/gentoopm/pkgcorepm/atom.py
+++ b/gentoopm/pkgcorepm/atom.py
@@ -9,8 +9,9 @@ from pkgcore.util.parserestrict import parse_match
 from gentoopm.basepm.atom import PMAtom
 
 class PkgCoreAtom(PMAtom):
-	def __init__(self, s):
+	def __init__(self, s, pkg = None):
 		self._r = parse_match(s)
+		self._pkg = pkg
 
 	def __contains__(self, pkg):
 		return self._r.match(pkg._pkg)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index 47732ab..f26cdbd 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -43,7 +43,7 @@ class PkgCorePackage(PMPackage):
 
 	@property
 	def atom(self):
-		return PkgCoreAtom('=%s' % self.id)
+		return PkgCoreAtom('=%s' % self.id, self)
 
 	def __cmp__(self, other):
 		if not isinstance(other, PkgCorePackage):

diff --git a/gentoopm/portagepm/atom.py b/gentoopm/portagepm/atom.py
index 63fcbef..70e7629 100644
--- a/gentoopm/portagepm/atom.py
+++ b/gentoopm/portagepm/atom.py
@@ -22,20 +22,21 @@ class FakeSettings(object):
 		return lambda: collections.defaultdict(lambda: '')
 
 class PortageAtom(object):
-	def __new__(self, s):
+	def __new__(self, s, pkg = None):
 		try:
 			a = dep_expand(s, settings = FakeSettings())
 		except pe.InvalidAtom:
 			raise InvalidAtomStringError('Incorrect atom: %s' % s)
 
 		if catsplit(a.cp)[0] == 'null':
-			return UnexpandedPortageAtom(a)
+			return UnexpandedPortageAtom(a, pkg)
 		else:
-			return CompletePortageAtom(a)
+			return CompletePortageAtom(a, pkg)
 
 class CompletePortageAtom(PMAtom):
-	def __init__(self, a):
+	def __init__(self, a, pkg):
 		self._atom = a
+		self._pkg = pkg
 
 	def __contains__(self, pkg):
 		# SLOT matching requires metadata so delay it.

diff --git a/gentoopm/portagepm/pkg.py b/gentoopm/portagepm/pkg.py
index dd48252..cb17e0e 100644
--- a/gentoopm/portagepm/pkg.py
+++ b/gentoopm/portagepm/pkg.py
@@ -45,7 +45,7 @@ class PortageDBCPV(PMPackage):
 
 	@property
 	def atom(self):
-		return PkgCoreAtom('=%s' % self.id)
+		return PkgCoreAtom('=%s' % self.id, self)
 
 class PortageCPV(PortageDBCPV):
 	def __init__(self, cpv, dbapi, tree, repo_prio):



             reply	other threads:[~2011-07-14  7:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14  7:32 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-07-26 20:10 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/pkgcorepm/, gentoopm/paludispm/ 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=73ec5c0c1a28d16f22c4d0cd292045511d85946f.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