Use finally block for autounmask handling inside
authorZac Medico <zmedico@gentoo.org>
Fri, 6 Aug 2010 22:53:26 +0000 (15:53 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 6 Aug 2010 22:53:26 +0000 (15:53 -0700)
_select_atoms_highest_available.

pym/_emerge/depgraph.py

index 691a7560e8b889f493e7c7cc24d2604eb30b870b..82388bb42c5a1bc88b205b4105a103551f6a2e2f 100644 (file)
@@ -2138,13 +2138,15 @@ class depgraph(object):
                """This will raise InvalidDependString if necessary. If trees is
                None then self._dynamic_config._filtered_trees is used."""
 
-               _autounmask_backup = self._dynamic_config._autounmask
-               self._dynamic_config._autounmask = False
                pkgsettings = self._frozen_config.pkgsettings[root]
                if trees is None:
                        trees = self._dynamic_config._filtered_trees
                atom_graph = digraph()
                if True:
+                       # Temporarily disable autounmask so that || preferences
+                       # account for masking and USE settings.
+                       _autounmask_backup = self._dynamic_config._autounmask
+                       self._dynamic_config._autounmask = False
                        try:
                                if parent is not None:
                                        trees[root]["parent"] = parent
@@ -2157,6 +2159,7 @@ class depgraph(object):
                                        pkgsettings, myuse=myuse,
                                        myroot=root, trees=trees)
                        finally:
+                               self._dynamic_config._autounmask = _autounmask_backup
                                if parent is not None:
                                        trees[root].pop("parent")
                                        trees[root].pop("atom_graph")
@@ -2190,7 +2193,6 @@ class depgraph(object):
                                selected_atoms[pkg] = [atom for atom in \
                                        atom_graph.child_nodes(node) if atom in chosen_atoms]
 
-               self._dynamic_config._autounmask = _autounmask_backup
                return selected_atoms
 
        def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None,