diff options
Diffstat (limited to 'pym')
-rw-r--r-- | pym/_emerge/__init__.py | 19 | ||||
-rw-r--r-- | pym/portage/dbapi/vartree.py | 19 |
2 files changed, 28 insertions, 10 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 9046dd265..1aafd64d9 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -24,6 +24,7 @@ import array from collections import deque import fcntl import fpformat +import logging import select import shlex import shutil @@ -8320,7 +8321,7 @@ class Scheduler(PollScheduler): _fetch_log = "/var/log/emerge-fetch.log" class _iface_class(SlotObject): - __slots__ = ("dblinkEbuildPhase", "dblinkDisplayUnmerge", "fetch", + __slots__ = ("dblinkEbuildPhase", "dblinkDisplayMerge", "fetch", "register", "schedule", "unregister") class _fetch_iface_class(SlotObject): @@ -8385,7 +8386,7 @@ class Scheduler(PollScheduler): schedule=self._schedule_fetch) self._sched_iface = self._iface_class( dblinkEbuildPhase=self._dblink_ebuild_phase, - dblinkDisplayUnmerge=self._dblink_display_unmerge, + dblinkDisplayMerge=self._dblink_display_merge, fetch=fetch_iface, register=self._register, schedule=self._schedule_wait, unregister=self._unregister) @@ -8575,14 +8576,22 @@ class Scheduler(PollScheduler): finally: f.close() - def _dblink_display_unmerge(self, settings, msg, noiselevel=0): + def _dblink_display_merge(self, settings, msg, level=0): log_path = settings.get("PORTAGE_LOG_FILE") background = self._max_jobs > 1 + + if level >= logging.WARNING: + noiselevel = -1 + msg_func = writemsg + else: + noiselevel = 0 + msg_func = portage.writemsg_stdout + if log_path is None: - portage.writemsg_stdout(msg, noiselevel=noiselevel) + msg_func(msg, noiselevel=noiselevel) else: if not background: - portage.writemsg_stdout(msg, noiselevel=noiselevel) + msg_func(msg, noiselevel=noiselevel) self._append_to_log_path(log_path, msg) def _dblink_ebuild_phase(self, diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 8eb640007..49b7442a6 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -28,6 +28,7 @@ from portage.elog.messages import ewarn from portage.elog.filtering import filter_mergephases, filter_unmergephases import os, re, sys, stat, errno, commands, copy, time, subprocess +import logging from itertools import izip try: @@ -1738,6 +1739,15 @@ class dblink(object): contents=contents, env=self.settings.environ()) return os.EX_OK + def _display_merge(self, msg, level=0): + if level >= logging.WARNING: + noiselevel = -1 + msg_func = writemsg + else: + noiselevel = 0 + msg_func = writemsg_stdout + msg_func(msg, noiselevel=noiselevel) + def _unmerge_pkgfiles(self, pkgfiles, others_in_slot): """ @@ -1752,12 +1762,11 @@ class dblink(object): """ if self._scheduler is None: - def showMessage(msg, noiselevel=0): - writemsg_stdout(msg, noiselevel=noiselevel) + showMessage = self._display_merge else: - def showMessage(msg, noiselevel=0): - self._scheduler.dblinkDisplayUnmerge( - self.settings, msg, noiselevel=noiselevel) + def showMessage(msg, level=0): + self._scheduler.dblinkDisplayMerge( + self.settings, msg, level=level) if not pkgfiles: showMessage("No package files given... Grabbing a set.\n") |