summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-11-14 07:35:29 +0000
committerZac Medico <zmedico@gentoo.org>2006-11-14 07:35:29 +0000
commit3ba185018aebd597f2d8c92da6cbeb0d6aac52ad (patch)
tree9f74af3f83091ae944aa5c41eab1f39ae2295892 /pym
parente9a521c075def390739ee39bc464461a123b715a (diff)
downloadportage-3ba185018aebd597f2d8c92da6cbeb0d6aac52ad.tar.gz
portage-3ba185018aebd597f2d8c92da6cbeb0d6aac52ad.tar.bz2
portage-3ba185018aebd597f2d8c92da6cbeb0d6aac52ad.zip
Make fakedbapi support generic metadata instead of just slots.
svn path=/main/trunk/; revision=5042
Diffstat (limited to 'pym')
-rw-r--r--pym/portage.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 23f51c50d..44e99d7eb 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -4236,10 +4236,13 @@ class fakedbapi(dbapi):
def cpv_all(self):
return self.cpvdict.keys()
- def cpv_inject(self, mycpv, myslot=None):
+ def cpv_inject(self, mycpv, metadata=None):
"""Adds a cpv from the list of available packages."""
mycp=cpv_getkey(mycpv)
- self.cpvdict[mycpv] = myslot
+ self.cpvdict[mycpv] = metadata
+ myslot = None
+ if metadata:
+ myslot = metadata.get("SLOT", None)
if myslot and mycp in self.cpdict:
# If necessary, remove another package in the same SLOT.
for cpv in self.cpdict[mycp]:
@@ -4276,13 +4279,10 @@ class fakedbapi(dbapi):
def aux_get(self, mycpv, wants):
if not self.cpv_exists(mycpv):
raise KeyError(mycpv)
- values = []
- for x in wants:
- if x == "SLOT":
- values.append(self.cpvdict[mycpv])
- else:
- values.append("")
- return values
+ metadata = self.cpvdict[mycpv]
+ if not metadata:
+ return ["" for x in wants]
+ return [metadata.get(x, "") for x in wants]
class bindbapi(fakedbapi):
def __init__(self, mybintree=None, settings=None):