From ec8a67f9e543221cc9ecbe3ef2eaf2c9c9085029 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Wed, 7 Sep 2011 21:59:24 +0200 Subject: [PATCH] [entropy.spm] PortagePlugin: catch KeyError when needed for match_installed_package() --- .../interfaces/portage_plugin/__init__.py | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/libraries/entropy/spm/plugins/interfaces/portage_plugin/__init__.py b/libraries/entropy/spm/plugins/interfaces/portage_plugin/__init__.py index 41a8b99bc..a0ee9dfa4 100644 --- a/libraries/entropy/spm/plugins/interfaces/portage_plugin/__init__.py +++ b/libraries/entropy/spm/plugins/interfaces/portage_plugin/__init__.py @@ -2354,7 +2354,11 @@ class PortagePlugin(SpmPlugin): for myatom in runatoms: # check if atom is available - if not self.match_installed_package(myatom): + try: + inst_match = self.match_installed_package(myatom) + except KeyError: + inst_match = None + if not inst_match: self.__output.output( red("%s: " % (_("package not available on system"),) ) + \ blue(myatom), @@ -3019,8 +3023,11 @@ class PortagePlugin(SpmPlugin): with self._PortageVdbLocker(self): - others_installed = self.match_installed_package(key, - match_all = True) + try: + others_installed = self.match_installed_package(key, + match_all = True) + except KeyError: + others_installed = [] # Support for tagged packages slot = package_metadata['slot'] @@ -3889,13 +3896,21 @@ class PortagePlugin(SpmPlugin): for item in dep_list: if isinstance(item, const_get_stringtype()): # match in currently running system - if self.match_installed_package(item): + try: + item_match = self.match_installed_package(item) + except KeyError: + item_match = None + if item_match: return [item] else: # and deps, all have to match all_matched = True for dep in item: - if not self.match_installed_package(dep): + try: + item_match = self.match_installed_package(dep) + except KeyError: + item_match = None + if not item_match: all_matched = False break if all_matched: