Bu #275217 - Part 1 - Resolve the circular dep between Scheduler and
authorZac Medico <zmedico@gentoo.org>
Tue, 23 Jun 2009 20:38:40 +0000 (20:38 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 23 Jun 2009 20:38:40 +0000 (20:38 -0000)
depgraph; mark all functions as local that aren't used outside of depgraph.
Thanks to Sebastian Mingramm (few) <s.mingramm@gmx.de> for this patch.

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

pym/_emerge/Scheduler.py
pym/_emerge/depgraph.py

index 7cf71343a1e4cc56998cc3d4c17a9805ebd0bbb5..f70cdd31202fa39dec58a671b66773dd47532677 100644 (file)
@@ -27,6 +27,7 @@ from _emerge.clear_caches import clear_caches
 from _emerge.create_depgraph_params import create_depgraph_params
 from _emerge.create_world_atom import create_world_atom
 from _emerge.DepPriority import DepPriority
+from _emerge.depgraph import depgraph
 from _emerge.EbuildFetcher import EbuildFetcher
 from _emerge.EbuildPhase import EbuildPhase
 from _emerge.emergelog import emergelog, _emerge_log_dir
@@ -42,12 +43,6 @@ from _emerge.SlotObject import SlotObject
 from _emerge.SequentialTaskQueue import SequentialTaskQueue
 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
 
-import portage.proxy.lazyimport
-import portage.proxy as proxy
-proxy.lazyimport.lazyimport(globals(),
-       '_emerge.depgraph:depgraph',
-)
-
 class Scheduler(PollScheduler):
 
        _opts_ignore_blockers = \
index b5901285bd09610e1b9a63c663c9e09c8f9df63f..29c9ed9c6239061dad5e9c63003428d2dce87050 100644 (file)
@@ -47,12 +47,6 @@ from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
 from _emerge.UnmergeDepPriority import UnmergeDepPriority
 from _emerge.visible import visible
 
-import portage.proxy.lazyimport
-import portage.proxy as proxy
-proxy.lazyimport.lazyimport(globals(),
-       '_emerge.Scheduler:Scheduler',
-)
-#from _emerge.Scheduler import Scheduler
 class depgraph(object):
 
        pkg_tree_map = RootConfig.pkg_tree_map
@@ -69,7 +63,8 @@ class depgraph(object):
                        self.edebug = 1
                self.spinner = spinner
                self._running_root = trees["/"]["root_config"]
-               self._opts_no_restart = Scheduler._opts_no_restart
+               self._opts_no_restart = frozenset(["--buildpkgonly",
+                       "--fetchonly", "--fetch-all-uri", "--pretend"])
                self.pkgsettings = {}
                # Maps slot atom to package for each Package added to the graph.
                self._slot_pkg_map = {}
@@ -2235,7 +2230,7 @@ class depgraph(object):
                        self._pkg_cache[pkg] = pkg
                return pkg
 
-       def validate_blockers(self):
+       def _validate_blockers(self):
                """Remove any blockers from the digraph that do not match any of the
                packages within the graph.  If necessary, create hard deps to ensure
                correct merge order such that mutually blocking packages are never
@@ -2625,7 +2620,7 @@ class depgraph(object):
                if not self._complete_graph():
                        raise self._unknown_internal_error()
 
-               if not self.validate_blockers():
+               if not self._validate_blockers():
                        raise self._unknown_internal_error()
 
                if self._slot_collision_info:
@@ -3772,7 +3767,7 @@ class depgraph(object):
                                        if "--changelog" in self.myopts:
                                                inst_matches = vardb.match(pkg.slot_atom)
                                                if inst_matches:
-                                                       changelogs.extend(self.calc_changelog(
+                                                       changelogs.extend(self._calc_changelog(
                                                                portdb.findname(pkg_key),
                                                                inst_matches[0], pkg_key))
                                else:
@@ -4267,7 +4262,7 @@ class depgraph(object):
                        show_mask_docs()
                        print
 
-       def calc_changelog(self,ebuildpath,current,next):
+       def _calc_changelog(self,ebuildpath,current,next):
                if ebuildpath == None or not os.path.exists(ebuildpath):
                        return []
                current = '-'.join(portage.catpkgsplit(current)[1:])
@@ -4301,7 +4296,7 @@ class depgraph(object):
                        return []
                return divisions
 
-       def find_changelog_tags(self,changelog):
+       def _find_changelog_tags(self,changelog):
                divs = []
                release = None
                while 1:
@@ -4376,7 +4371,7 @@ class depgraph(object):
                if world_locked:
                        world_set.unlock()
 
-       def loadResumeCommand(self, resume_data, skip_masked=True,
+       def _loadResumeCommand(self, resume_data, skip_masked=True,
                skip_missing=True):
                """
                Add a resume command to the graph and validate it in the process.  This
@@ -4802,7 +4797,7 @@ def resume_depgraph(settings, trees, mtimedb, myopts, myparams, spinner):
                mydepgraph = depgraph(settings, trees,
                        myopts, myparams, spinner)
                try:
-                       success = mydepgraph.loadResumeCommand(mtimedb["resume"],
+                       success = mydepgraph._loadResumeCommand(mtimedb["resume"],
                                skip_masked=skip_masked)
                except depgraph.UnsatisfiedResumeDep, e:
                        if not skip_unsatisfied: