diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-19 07:24:43 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-19 07:24:43 +0000 |
commit | 0398470e5029fe096a4400a2a6a79ef40076a691 (patch) | |
tree | 318020e9e2e2918256ccbe00732aba91fe813411 | |
parent | bb1b9642c1f192910cda6f8bc436abfdd4a72f3c (diff) | |
download | portage-0398470e5029fe096a4400a2a6a79ef40076a691.tar.gz portage-0398470e5029fe096a4400a2a6a79ef40076a691.tar.bz2 portage-0398470e5029fe096a4400a2a6a79ef40076a691.zip |
Add a Scheduler._background_mode() method to control background mode, and
trigger it if either --quiet is enabled or --jobs > 1.
svn path=/main/trunk/; revision=11133
-rw-r--r-- | pym/_emerge/__init__.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 029c90791..3693d44bf 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -8718,7 +8718,7 @@ class Scheduler(PollScheduler): if max_jobs is None: max_jobs = 1 self._set_max_jobs(max_jobs) - background = self._max_jobs > 1 + background = self._background_mode() self._max_load = myopts.get("--load-average") @@ -8764,6 +8764,9 @@ class Scheduler(PollScheduler): self._max_jobs = max_jobs self._task_queues.jobs.max_jobs = max_jobs + def _background_mode(self): + return self._max_jobs > 1 or "--quiet" in self.myopts + def _set_digraph(self, digraph): if self._max_jobs < 2: # save some memory @@ -8891,7 +8894,7 @@ class Scheduler(PollScheduler): log_path = pkg_dblink.settings.get("PORTAGE_LOG_FILE") log_file = None out = sys.stdout - background = self._max_jobs > 1 + background = self._background_mode() if background and log_path is not None: log_file = open(log_path, 'a') @@ -8906,7 +8909,7 @@ class Scheduler(PollScheduler): def _dblink_display_merge(self, pkg_dblink, msg, level=0, noiselevel=0): log_path = pkg_dblink.settings.get("PORTAGE_LOG_FILE") - background = self._max_jobs > 1 + background = self._background_mode() if log_path is None: if not (background and level < logging.WARN): @@ -8929,7 +8932,7 @@ class Scheduler(PollScheduler): scheduler = self._sched_iface settings = pkg_dblink.settings pkg = self._dblink_pkg(pkg_dblink) - background = self._max_jobs > 1 + background = self._background_mode() log_path = settings.get("PORTAGE_LOG_FILE") ebuild_phase = EbuildPhase(background=background, @@ -9188,7 +9191,7 @@ class Scheduler(PollScheduler): self._logger.log(" *** Finished. Cleaning up...") - background = self._max_jobs > 1 + background = self._background_mode() if self._failed_pkgs_all and background and \ self._failed_pkgs_die_msgs and \ not _flush_elog_mod_echo(): @@ -9413,7 +9416,7 @@ class Scheduler(PollScheduler): """ task_queues = self._task_queues - background = self._max_jobs > 1 + background = self._background_mode() self._logger.parallel = background self._status_display.quiet = \ not background or \ |