Make EbuildPhase._elog() use the NOCOLOR variable from self.settings,
authorZac Medico <zmedico@gentoo.org>
Sun, 5 Sep 2010 07:56:44 +0000 (00:56 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 5 Sep 2010 07:56:44 +0000 (00:56 -0700)
so presence of color in the log file is consistent.

pym/_emerge/EbuildPhase.py

index a5d617f652994d42b38b6bc90b17e3d3394af72d..fd010c059538a16f29e667808d608c26dac91754 100644 (file)
@@ -219,8 +219,14 @@ class EbuildPhase(CompositeTask):
                out = StringIO()
                phase = self.phase
                elog_func = getattr(elog_messages, elog_funcname)
-               for line in lines:
-                       elog_func(line, phase=phase, key=self.settings.mycpv, out=out)
+               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: