Make SubProcess._wait() call scheduler.schedule(self.reg_id) so it's
authorZac Medico <zmedico@gentoo.org>
Mon, 7 Jul 2008 11:45:27 +0000 (11:45 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 7 Jul 2008 11:45:27 +0000 (11:45 -0000)
encapsulated and callers don't have to know about it.

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

pym/_emerge/__init__.py

index 0037f988d50989e8abd4de75d2ccf73ee9eed9c1..4c63a63797fdb927b1f4a6e3229cdbd7584e82cd 100644 (file)
@@ -1560,8 +1560,6 @@ class CompositeTask(AsynchronousTask):
                        task = self._current_task
                        if task is None:
                                break
-                       if hasattr(task, "reg_id"):
-                               self.scheduler.schedule(task.reg_id)
                        task.wait()
 
                return self.returncode
@@ -1655,7 +1653,7 @@ class TaskSequence(CompositeTask):
                        self.wait()
 
 class SubProcess(AsynchronousTask):
-       __slots__ = ("pid",)
+       __slots__ = ("pid", "reg_id", "scheduler")
 
        # A file descriptor is required for the scheduler to monitor changes from
        # inside a poll() loop. When logging is not enabled, create a pipe just to
@@ -1686,6 +1684,7 @@ class SubProcess(AsynchronousTask):
        def _wait(self):
                if self.returncode is not None:
                        return self.returncode
+               self.scheduler.schedule(self.reg_id)
                self._set_returncode(os.waitpid(self.pid, 0))
                return self.returncode
 
@@ -1713,7 +1712,7 @@ class SpawnProcess(SubProcess):
                "uid", "gid", "groups", "umask", "logfile",
                "path_lookup", "pre_exec")
 
-       __slots__ = ("args", "files", "registered", "reg_id", "scheduler") + \
+       __slots__ = ("args", "files", "registered") + \
                _spawn_kwarg_names
 
        _file_names = ("process", "out")
@@ -2161,8 +2160,8 @@ class EbuildExecuter(CompositeTask):
 class EbuildPhase(SubProcess):
 
        __slots__ = ("fd_pipes", "phase", "pkg",
-               "scheduler", "settings", "tree",
-               "files", "registered", "reg_id")
+               "settings", "tree",
+               "files", "registered")
 
        _file_names = ("log", "stdout", "ebuild")
        _files_dict = slot_dict_class(_file_names, prefix="")