summaryrefslogtreecommitdiff
path: root/apt/cache.py
diff options
context:
space:
mode:
Diffstat (limited to 'apt/cache.py')
-rw-r--r--apt/cache.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 83f0bd3d..973291c0 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -50,7 +50,6 @@ class Cache(object):
self._records = apt_pkg.GetPkgRecords(self._cache)
self._dict = {}
-
# build the packages dict
if progress != None:
progress.Op = "Building data structures"
@@ -64,14 +63,21 @@ class Cache(object):
if len(pkg.VersionList) > 0:
self._dict[pkg.Name] = Package(self._cache, self._depcache,
self._records, self, pkg)
+
i += 1
if progress != None:
progress.done()
self._runCallbacks("cache_post_open")
def __getitem__(self, key):
+ """ look like a dictionary (get key) """
return self._dict[key]
+ def __iter__(self):
+ for pkgname in self._dict.keys():
+ yield self._dict[pkgname]
+ raise StopIteration
+
def has_key(self, key):
try:
self._dict[key]