From 145d69342301e3a6372a172cfd2eb8069a6a0b3e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 24 Sep 2011 14:44:36 -0700 Subject: portdbapi.xmatch: combine match-all with others This eliminates redundant code. --- pym/portage/dbapi/porttree.py | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 94b25e8e7..62a1e8f55 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -868,26 +868,7 @@ class portdbapi(dbapi): myval = match_from_list(mydep, self.cp_list(mykey, mytree=mytree)) - elif level == "match-all": - # match *all* visible *and* masked packages - if mydep == mykey: - myval = self.cp_list(mykey, mytree=mytree) - elif mydep.repo is not None: - myval = list(self._iter_match(mydep, - self.cp_list(mykey, mytree=mytree))) - else: - myval = set() - # We iterate over self.porttrees, since it's common to - # tweak this attribute in order to adjust match behavior. - for tree in self.porttrees: - repo = self.repositories.get_name_for_location(tree) - myval.update(self._iter_match(mydep.with_repo(repo), - self.cp_list(mykey, mytree=tree))) - myval = list(myval) - if len(myval) > 1: - self._cpv_sort_ascending(myval) - - elif level in ("bestmatch-visible", "match-visible", + elif level in ("bestmatch-visible", "match-all", "match-visible", "minimum-all", "minimum-visible"): # Find the minimum matching visible version. This is optimized to # minimize the number of metadata accesses (improves performance @@ -898,8 +879,8 @@ class portdbapi(dbapi): mylist = match_from_list(mydep, self.cp_list(mykey, mytree=mytree)) - visibility_filter = level != "minimum-all" - single_match = level != "match-visible" + visibility_filter = level not in ("match-all", "minimum-all") + single_match = level not in ("match-all", "match-visible") myval = [] aux_keys = list(self._aux_cache_keys) if level == "bestmatch-visible": -- cgit v1.2.3-1-g7c22