summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/cache.py8
-rw-r--r--debian/changelog2
2 files changed, 8 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):
"""
diff --git a/debian/changelog b/debian/changelog
index 450492c4..a7204a0a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ python-apt (0.7.93) UNRELEASED; urgency=low
like apt-get --print-uris update (cf. #551164).
* Build for all supported Python versions.
- Disable 2.6 and 3.1 builds previously available in experimental.
+ * Merge lp:~forest-bond/python-apt/cache-is-virtual-package-catch-key-error
+ - Return False in Cache.is_virtual_package if the package does not exist.
[ Colin Watson ]
* apt/progress/__init__.py: