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>
Wed, 4 May 2011 19:53:47 +0000 (12:53 -0700)
pym/_emerge/depgraph.py

index 5d715a2eade1985fa483e13f5b51bce4eb4dd127..8750a18e93109c5d04355d17a597b9a3bd6a9fe8 100644 (file)
@@ -1221,6 +1221,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:
+                       # 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