summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-05 01:19:32 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-05 01:19:32 -0700
commit0433ac7ff26aca04633a765837051fe2ddcd82de (patch)
treee19217dcebdc3249719954310ad033fb721a1046
parent702204887eeec7b15a3536d5fbe22fe3d5c498a5 (diff)
downloadportage-0433ac7ff26aca04633a765837051fe2ddcd82de.tar.gz
portage-0433ac7ff26aca04633a765837051fe2ddcd82de.tar.bz2
portage-0433ac7ff26aca04633a765837051fe2ddcd82de.zip
Add a more generic AbstractEbuildProcess._elog() method to replace
the existing _eerror() method.
-rw-r--r--pym/_emerge/AbstractEbuildProcess.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index 28e783e08..39c8c5683 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -6,7 +6,7 @@ import textwrap
from _emerge.SpawnProcess import SpawnProcess
from _emerge.EbuildIpcDaemon import EbuildIpcDaemon
import portage
-from portage.elog.messages import eerror
+from portage.elog import messages as elog_messages
from portage.localization import _
from portage.package.ebuild._ipc.ExitCommand import ExitCommand
from portage.package.ebuild._ipc.QueryCommand import QueryCommand
@@ -198,10 +198,20 @@ class AbstractEbuildProcess(SpawnProcess):
self._eerror(textwrap.wrap(msg, 72))
def _eerror(self, lines):
+ self._elog('eerror', lines)
+
+ def _elog(self, elog_funcname, lines):
out = StringIO()
phase = self.phase
- for line in lines:
- eerror(line, phase=phase, key=self.settings.mycpv, out=out)
+ elog_func = getattr(elog_messages, elog_funcname)
+ global_havecolor = portage.output.havecolor
+ try:
+ portage.output.havecolor = \
+ self.settings.get('NOCOLOR', 'false').lower() in ('no', 'false')
+ for line in lines:
+ elog_func(line, phase=phase, key=self.settings.mycpv, out=out)
+ finally:
+ portage.output.havecolor = global_havecolor
msg = _unicode_decode(out.getvalue(),
encoding=_encodings['content'], errors='replace')
if msg: