2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-25 11:19:52 +01:00

Describe why color_gcc.py is no longer relevant

This commit is contained in:
Waf Project 2024-02-18 16:06:05 +01:00
parent ea1412b7e7
commit 761ed9beda
2 changed files with 6 additions and 4 deletions

View File

@ -2,6 +2,9 @@
# encoding: utf-8 # encoding: utf-8
# Replaces the default formatter by one which understands GCC output and colorizes it. # Replaces the default formatter by one which understands GCC output and colorizes it.
#
# This is mostly obsolete as gcc/g++ provide colored outputs by default:
# CFLAGS="-fdiagnostics-color=always" CXXFLAGS="-fdiagnostics-color=always" waf configure clean build
__author__ = __maintainer__ = "Jérôme Carretero <cJ-waf@zougloub.eu>" __author__ = __maintainer__ = "Jérôme Carretero <cJ-waf@zougloub.eu>"
__copyright__ = "Jérôme Carretero, 2012" __copyright__ = "Jérôme Carretero, 2012"
@ -36,4 +39,3 @@ class ColorGCCFormatter(Logs.formatter):
def options(opt): def options(opt):
Logs.log.handlers[0].setFormatter(ColorGCCFormatter(Logs.colors)) Logs.log.handlers[0].setFormatter(ColorGCCFormatter(Logs.colors))

View File

@ -14,18 +14,18 @@ class ColorMSVCFormatter(Logs.formatter):
def __init__(self, colors): def __init__(self, colors):
self.colors = colors self.colors = colors
Logs.formatter.__init__(self) Logs.formatter.__init__(self)
def parseMessage(self, line, color): def parseMessage(self, line, color):
# Split messaage from 'disk:filepath: type: message' # Split messaage from 'disk:filepath: type: message'
arr = line.split(':', 3) arr = line.split(':', 3)
if len(arr) < 4: if len(arr) < 4:
return line return line
colored = self.colors.BOLD + arr[0] + ':' + arr[1] + ':' + self.colors.NORMAL colored = self.colors.BOLD + arr[0] + ':' + arr[1] + ':' + self.colors.NORMAL
colored += color + arr[2] + ':' + self.colors.NORMAL colored += color + arr[2] + ':' + self.colors.NORMAL
colored += arr[3] colored += arr[3]
return colored return colored
def format(self, rec): def format(self, rec):
frame = sys._getframe() frame = sys._getframe()
while frame: while frame: