diff options
| author | Julian Andres Klode <jak@debian.org> | 2010-01-15 15:32:13 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2010-01-15 15:32:13 +0100 |
| commit | fec0cfe1617ccfcbb7b291ba00dedacdd3f133f7 (patch) | |
| tree | 508002f92d02d9e17763105dc2ec0a089b148549 /apt | |
| parent | 28f42c1060c652e6f650ba4e046e3f8ab021d91b (diff) | |
| parent | 4ebf94a774873aef709bab624edb3724fe870f7d (diff) | |
| download | python-apt-fec0cfe1617ccfcbb7b291ba00dedacdd3f133f7.tar.gz | |
Return False in Cache.is_virtual_package if the package does not exist.
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/cache.py | 8 |
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): """ |
