Use a dict for depgraph params, so we can use it to store key/value pairs
authorZac Medico <zmedico@gentoo.org>
Thu, 9 Jul 2009 04:57:55 +0000 (04:57 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 9 Jul 2009 04:57:55 +0000 (04:57 -0000)
and fix the depgraph so it doesn't use emerge options directly.

svn path=/main/trunk/; revision=13809

pym/_emerge/create_depgraph_params.py
pym/_emerge/depgraph.py

index 78c79fe2d3ffd694dee8f863cb8f7c08127c07c2..77deb042dada057896b25a33e5e9fb69636db8e0 100644 (file)
@@ -12,11 +12,11 @@ def create_depgraph_params(myopts, myaction):
        # empty:     pretend nothing is merged
        # complete:  completely account for all known dependencies
        # remove:    build graph for use in removing packages
-       myparams = set(["recurse"])
+       myparams = {"recurse" : True}
 
        if myaction == "remove":
-               myparams.add("remove")
-               myparams.add("complete")
+               myparams["remove"] = True
+               myparams["complete"] = True
                return myparams
 
        if "--update" in myopts or \
@@ -24,15 +24,15 @@ def create_depgraph_params(myopts, myaction):
                "--reinstall" in myopts or \
                "--noreplace" in myopts or \
                "--selective" in myopts:
-               myparams.add("selective")
+               myparams["selective"] = True
        if "--emptytree" in myopts:
-               myparams.add("empty")
-               myparams.discard("selective")
+               myparams["empty"] = True
+               myparams.pop("selective", None)
        if "--nodeps" in myopts:
-               myparams.discard("recurse")
+               myparams.pop("recurse", None)
        if "--deep" in myopts:
-               myparams.add("deep")
+               myparams["deep"] = True
        if "--complete-graph" in myopts:
-               myparams.add("complete")
+               myparams["complete"] = True
        return myparams
 
index 6689f33e375113edc5ff86cb533541377bed4586..cb31b76c8f0b5aa8fd1c5a28fd20974a1809dbce 100644 (file)
@@ -2298,7 +2298,7 @@ class depgraph(object):
                self._select_package = self._select_pkg_from_graph
                already_deep = "deep" in self._dynamic_config.myparams
                if not already_deep:
-                       self._dynamic_config.myparams.add("deep")
+                       self._dynamic_config.myparams["deep"] = True
 
                for root in self._frozen_config.roots:
                        required_set_names = self._frozen_config._required_set_names.copy()
@@ -3384,7 +3384,7 @@ class depgraph(object):
                if have_uninstall_task and \
                        not complete and \
                        not unsolvable_blockers:
-                       self._dynamic_config.myparams.add("complete")
+                       self._dynamic_config.myparams["complete"] = True
                        raise self._serialize_tasks_retry("")
 
                if unsolvable_blockers and \
@@ -4523,7 +4523,7 @@ class depgraph(object):
                        self._dynamic_config._scheduler_graph = self._dynamic_config.digraph
                else:
                        self._select_package = self._select_pkg_from_graph
-                       self._dynamic_config.myparams.add("selective")
+                       self._dynamic_config.myparams["selective"] = True
                        # Always traverse deep dependencies in order to account for
                        # potentially unsatisfied dependencies of installed packages.
                        # This is necessary for correct --keep-going or --resume operation
@@ -4536,7 +4536,7 @@ class depgraph(object):
                        # deep depenedencies of a scheduled build, that build needs to
                        # be cancelled. In order for this type of situation to be
                        # recognized, deep traversal of dependencies is required.
-                       self._dynamic_config.myparams.add("deep")
+                       self._dynamic_config.myparams["deep"] = True
 
                        favorites = resume_data.get("favorites")
                        args_set = self._dynamic_config._sets["args"]