diff options
-rw-r--r-- | pym/_emerge/depgraph.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 1c6907669..5a7d2b761 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1705,8 +1705,18 @@ class depgraph(object): if len(expanded_atoms) > 1 and len(installed_cp_set) == 1: installed_cp = next(iter(installed_cp_set)) - expanded_atoms = [atom for atom in expanded_atoms \ - if atom.cp == installed_cp] + for atom in expanded_atoms: + if atom.cp == installed_cp: + available = False + for pkg in self._iter_match_pkgs_any( + root_config, atom.without_use, + onlydeps=onlydeps): + if not pkg.installed: + available = True + break + if available: + expanded_atoms = [atom] + break # If a non-virtual package and one or more virtual packages # are in expanded_atoms, use the non-virtual package. @@ -2372,6 +2382,13 @@ class depgraph(object): show_mask_docs() print() + def _iter_match_pkgs_any(self, root_config, atom, onlydeps=False): + for db, pkg_type, built, installed, db_keys in \ + self._dynamic_config._filtered_trees[root_config.root]["dbs"]: + for pkg in self._iter_match_pkgs(root_config, + pkg_type, atom, onlydeps=onlydeps): + yield pkg + def _iter_match_pkgs(self, root_config, pkg_type, atom, onlydeps=False): """ Iterate over Package instances of pkg_type matching the given atom. |