summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-28 17:59:54 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-28 17:59:54 -0700
commit2199ae89850d18030fde680a7ffe97e1405c8a7e (patch)
tree2d2cccaef4b31a3b42037fd37393b4a002557242
parentcd9b32f1e63e2c13b1f0da4cbd6c5c0c2787bb93 (diff)
downloadportage-2199ae89850d18030fde680a7ffe97e1405c8a7e.tar.gz
portage-2199ae89850d18030fde680a7ffe97e1405c8a7e.tar.bz2
portage-2199ae89850d18030fde680a7ffe97e1405c8a7e.zip
Add a Scheduler._running_tasks() set in order to simplify the
_is_work_scheduled() method.
-rw-r--r--pym/_emerge/Scheduler.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index be4ef48af..68518e99f 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -222,6 +222,7 @@ class Scheduler(PollScheduler):
self._prefetchers = weakref.WeakValueDictionary()
self._pkg_queue = []
+ self._running_tasks = set()
self._completed_tasks = set()
self._failed_pkgs = []
@@ -1256,6 +1257,7 @@ class Scheduler(PollScheduler):
def _do_merge_exit(self, merge):
pkg = merge.merge.pkg
+ self._running_tasks.remove(pkg)
if merge.returncode != os.EX_OK:
settings = merge.merge.settings
build_dir = settings.get("PORTAGE_BUILDDIR")
@@ -1308,6 +1310,7 @@ class Scheduler(PollScheduler):
self._task_queues.merge.add(merge)
self._status_display.merges = len(self._task_queues.merge)
else:
+ self._running_tasks.remove(build.pkg)
settings = build.settings
build_dir = settings.get("PORTAGE_BUILDDIR")
build_log = settings.get("PORTAGE_LOG_FILE")
@@ -1499,8 +1502,7 @@ class Scheduler(PollScheduler):
not (self._failed_pkgs and not self._build_opts.fetchonly))
def _is_work_scheduled(self):
- return bool(self._jobs or \
- self._task_queues.merge or self._merge_wait_queue)
+ return bool(self._running_tasks)
def _schedule_tasks(self):
@@ -1585,6 +1587,7 @@ class Scheduler(PollScheduler):
self._pkg_count.curval += 1
task = self._task(pkg)
+ self._running_tasks.add(pkg)
if pkg.installed:
merge = PackageMerge(merge=task)