From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/
Date: Tue, 19 Jul 2011 20:53:32 +0000 (UTC) [thread overview]
Message-ID: <eb76b8c4e201184e51e4cdf169b971e6cb3ddae4.mgorny@gentoo> (raw)
commit: eb76b8c4e201184e51e4cdf169b971e6cb3ddae4
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 19 20:35:26 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 19 20:35:26 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=eb76b8c4
Portage: move _aux_get() wrapper directly to Portage{,DB}CPV.
---
gentoopm/portagepm/pkg.py | 33 ++++++++++++---------------------
1 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/gentoopm/portagepm/pkg.py b/gentoopm/portagepm/pkg.py
index b421596..e8bf6b5 100644
--- a/gentoopm/portagepm/pkg.py
+++ b/gentoopm/portagepm/pkg.py
@@ -47,7 +47,7 @@ class PortageDBCPV(PMPackage, CompletePortageAtom):
@property
def metadata(self):
- return PortageDBMetadata(self._cpv, self._dbapi)
+ return PortageMetadata(self)
@property
def path(self):
@@ -62,6 +62,9 @@ class PortageDBCPV(PMPackage, CompletePortageAtom):
def version(self):
return PortagePackageVersion(self._cpv)
+ def _aux_get(self, *keys):
+ return self._dbapi.aux_get(self._cpv, keys)
+
@property
def description(self):
return PortagePackageDescription(self.metadata) # XXX
@@ -105,10 +108,6 @@ class PortageCPV(PortageDBCPV):
self._repo_prio = repo_prio
@property
- def metadata(self):
- return PortageMetadata(self._cpv, self._dbapi, self._tree)
-
- @property
def path(self):
return StringWrapper(self._dbapi.findname(self._cpv, self._tree))
@@ -116,6 +115,10 @@ class PortageCPV(PortageDBCPV):
def repository(self):
return StringWrapper(self._dbapi.getRepositoryName(self._tree))
+ def _aux_get(self, *keys):
+ return self._dbapi.aux_get(self._cpv, keys,
+ mytree = self._tree)
+
def __str__(self):
return '=%s::%s' % (self._cpv, self.repository)
@@ -127,23 +130,11 @@ class PortageCPV(PortageDBCPV):
or vercmp(cpv_getversion(self._cpv), cpv_getversion(other._cpv)) < 0 \
or self._repo_prio < other._repo_prio
-class PortageDBMetadata(PMPackageMetadata):
- def __init__(self, cpv, dbapi):
- self._cpv = cpv
- self._dbapi = dbapi
-
- def __getattr__(self, key):
- if key not in self:
- raise AttributeError('Unsupported metadata key: %s' % key)
- return self._dbapi.aux_get(self._cpv, [key])[0]
-
-class PortageMetadata(PortageDBMetadata):
- def __init__(self, cpv, dbapi, tree):
- PortageDBMetadata.__init__(self, cpv, dbapi)
- self._tree = tree
+class PortageMetadata(PMPackageMetadata):
+ def __init__(self, pkg):
+ self._pkg = pkg
def __getattr__(self, key):
if key not in self:
raise AttributeError('Unsupported metadata key: %s' % key)
- return self._dbapi.aux_get(self._cpv, [key],
- mytree = self._tree)[0]
+ return self._pkg._aux_get(key)[0]
next reply other threads:[~2011-07-19 20:53 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-19 20:53 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-02-16 10:13 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/ Michał Górny
2013-02-03 19:40 Michał Górny
2012-12-10 17:52 Michał Górny
2011-08-15 7:57 Michał Górny
2011-08-14 14:22 Michał Górny
2011-08-12 7:28 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-27 16:04 Michał Górny
2011-07-27 8:26 Michał Górny
2011-07-26 17:30 Michał Górny
2011-07-26 17:18 Michał Górny
2011-07-25 17:06 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-20 9:41 Michał Górny
2011-07-19 20:53 Michał Górny
2011-07-19 20:53 Michał Górny
2011-07-19 20:53 Michał Górny
2011-07-15 13:32 Michał Górny
2011-07-15 12:34 Michał Górny
2011-07-15 8:39 Michał Górny
2011-07-14 14:05 Michał Górny
2011-07-14 13:31 Michał Górny
2011-07-10 22:17 Michał Górny
2011-07-10 22:17 Michał Górny
2011-07-10 22:17 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
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=eb76b8c4e201184e51e4cdf169b971e6cb3ddae4.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