depgraph: autounmask account for optional deps
authorZac Medico <zmedico@gentoo.org>
Mon, 2 May 2011 19:34:21 +0000 (12:34 -0700)
committerZac Medico <zmedico@gentoo.org>
Mon, 2 May 2011 19:34:21 +0000 (12:34 -0700)
pym/_emerge/depgraph.py

index 5183b27f6df7d61b23ff2c64cb1d60ce6fd21fda..dd1b5e843970ae9880dca85de184b967acfdd9cd 100644 (file)
@@ -1375,6 +1375,20 @@ class depgraph(object):
 
        def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string,
                allow_unsatisfied, ignore_blockers=False):
+               _autounmask_backup = self._dynamic_config._autounmask
+               if dep_priority.optional or dep_priority.ignored:
+                       # Temporarily disable autounmask for deps that
+                       # don't necessarily need to be satisfied.
+                       self._dynamic_config._autounmask = False
+               try:
+                       return self._wrapped_add_pkg_dep_string(
+                               pkg, dep_root, dep_priority, dep_string,
+                               allow_unsatisfied, ignore_blockers=ignore_blockers)
+               finally:
+                       self._dynamic_config._autounmask = _autounmask_backup
+
+       def _wrapped_add_pkg_dep_string(self, pkg, dep_root, dep_priority,
+               dep_string, allow_unsatisfied, ignore_blockers=False):
                depth = pkg.depth + 1
                deep = self._dynamic_config.myparams.get("deep", 0)
                recurse_satisfied = deep is True or depth <= deep