1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Disable colored output and progress bar when building outside of a TTY

This makes the output more readable if it is written to a file,
and more compact in continuous integration environments, keeping
the log sizes low.

This commit also adds myself to .mailmap.
This commit is contained in:
Hugo Locurcio
2018-01-13 17:56:41 +01:00
parent e141845bfb
commit bf32d36230
3 changed files with 28 additions and 12 deletions

View File

@@ -1549,18 +1549,26 @@ def save_active_platforms(apnames, ap):
def no_verbose(sys, env):
# If the output is not a terminal, do nothing
if not sys.stdout.isatty():
return
colors = {}
colors['cyan'] = '\033[96m'
colors['purple'] = '\033[95m'
colors['blue'] = '\033[94m'
colors['green'] = '\033[92m'
colors['yellow'] = '\033[93m'
colors['red'] = '\033[91m'
colors['end'] = '\033[0m'
# Colors are disabled in non-TTY environments such as pipes. This means
# that if output is redirected to a file, it will not contain color codes
if sys.stdout.isatty():
colors['cyan'] = '\033[96m'
colors['purple'] = '\033[95m'
colors['blue'] = '\033[94m'
colors['green'] = '\033[92m'
colors['yellow'] = '\033[93m'
colors['red'] = '\033[91m'
colors['end'] = '\033[0m'
else:
colors['cyan'] = ''
colors['purple'] = ''
colors['blue'] = ''
colors['green'] = ''
colors['yellow'] = ''
colors['red'] = ''
colors['end'] = ''
compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end'])
java_compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end'])