summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
Diffstat (limited to 'apt')
-rw-r--r--apt/cache.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/apt/cache.py b/apt/cache.py
index fdd50fa6..eea06d56 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -260,8 +260,12 @@ class Cache(object):
def is_virtual_package(self, pkgname):
"""Return whether the package is a virtual package."""
- pkg = self._cache[pkgname]
- return bool(pkg.provides_list and not pkg.version_list)
+ try:
+ pkg = self._cache[pkgname]
+ except KeyError:
+ return False
+ else:
+ return bool(pkg.provides_list and not pkg.version_list)
def get_providing_packages(self, virtual):
"""