From 9ba7b0ebd064517832cc37f45d8f549666a06825 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 18 Nov 2020 14:09:30 +0100 Subject: mlog: add __str__ method to AnsiDecorator Automatically colorize the text when printing the AnsiDecorator, based on the result of mlog.colorize_console(). This is how AnsiDecorator is used most of the time anyway. --- run_project_tests.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'run_project_tests.py') diff --git a/run_project_tests.py b/run_project_tests.py index 772aa2e..33641d7 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -43,6 +43,7 @@ from mesonbuild import mlog from mesonbuild import mtest from mesonbuild.build import ConfigurationData from mesonbuild.mesonlib import MachineChoice, Popen_safe, TemporaryDirectoryWinProof +from mesonbuild.mlog import bold, green, red, yellow from mesonbuild.coredata import backendlist, version as meson_version from run_tests import get_fake_options, run_configure, get_meson_script @@ -345,22 +346,6 @@ def log_text_file(logfile, testdir, stdo, stde): raise StopException() -def bold(text): - return mlog.bold(text).get_text(mlog.colorize_console()) - - -def green(text): - return mlog.green(text).get_text(mlog.colorize_console()) - - -def red(text): - return mlog.red(text).get_text(mlog.colorize_console()) - - -def yellow(text): - return mlog.yellow(text).get_text(mlog.colorize_console()) - - def _run_ci_include(args: T.List[str]) -> str: if not args: return 'At least one parameter required' -- cgit v1.1