aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/mlog.py3
-rwxr-xr-xrun_project_tests.py17
-rwxr-xr-xrun_tests.py6
3 files changed, 7 insertions, 19 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index 0cffba7..6207d98 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -130,6 +130,9 @@ class AnsiDecorator:
text = '"{}"'.format(text)
return text
+ def __str__(self) -> str:
+ return self.get_text(colorize_console())
+
def bold(text: str, quoted: bool = False) -> AnsiDecorator:
return AnsiDecorator(text, "\033[1m", quoted=quoted)
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'
diff --git a/run_tests.py b/run_tests.py
index da894c0..24d6a51 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -290,7 +290,7 @@ def run_configure(commandlist, env=None):
return run_configure_inprocess(commandlist, env=env)
def print_system_info():
- print(mlog.bold('System information.').get_text(mlog.colorize_console()))
+ print(mlog.bold('System information.'))
print('Architecture:', platform.architecture())
print('Machine:', platform.machine())
print('Platform:', platform.system())
@@ -364,7 +364,7 @@ def main():
print(flush=True)
returncode = 0
else:
- print(mlog.bold('Running unittests.').get_text(mlog.colorize_console()))
+ print(mlog.bold('Running unittests.'))
print(flush=True)
cmd = mesonlib.python_command + ['run_unittests.py', '-v']
if options.failfast:
@@ -377,7 +377,7 @@ def main():
else:
cross_test_args = mesonlib.python_command + ['run_cross_test.py']
for cf in options.cross:
- print(mlog.bold('Running {} cross tests.'.format(cf)).get_text(mlog.colorize_console()))
+ print(mlog.bold('Running {} cross tests.'.format(cf)))
print(flush=True)
cmd = cross_test_args + ['cross/' + cf]
if options.failfast: