summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
authorforest.bond@outpostembedded.com <>2010-01-13 22:14:49 -0500
committerforest.bond@outpostembedded.com <>2010-01-13 22:14:49 -0500
commit4ebf94a774873aef709bab624edb3724fe870f7d (patch)
tree4500195bc4f68cf89b97bc1a8a7536112626bcfa /apt
parent2cc697efb0bad365973c9dbfbd88fc7bb90b7a8f (diff)
downloadpython-apt-4ebf94a774873aef709bab624edb3724fe870f7d.tar.gz
* apt/cache.py
- isVirtualPackage: Return False instead of raising KeyError if the package is not present in the cache.
Diffstat (limited to 'apt')
-rw-r--r--apt/cache.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/apt/cache.py b/apt/cache.py
index fa6c404c..19c0ee4e 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -245,7 +245,10 @@ class Cache(object):
def isVirtualPackage(self, pkgname):
"""Return whether the package is a virtual package."""
- pkg = self._cache[pkgname]
+ try:
+ pkg = self._cache[pkgname]
+ except KeyError:
+ return False
return bool(pkg.ProvidesList and not pkg.VersionList)
def getProvidingPackages(self, virtual):