aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mlog.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-11-18 14:02:02 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2020-11-18 22:49:41 +0200
commitf1ce78d77f178deb7a458235132d1fc8c44d0afe (patch)
treea3cbc63e3483df2adf0576b0ca62ef8d2f669319 /mesonbuild/mlog.py
parentc8af3c8d29df9535b76ce62a8aafdbb0bc9cc10f (diff)
downloadmeson-f1ce78d77f178deb7a458235132d1fc8c44d0afe.zip
meson-f1ce78d77f178deb7a458235132d1fc8c44d0afe.tar.gz
meson-f1ce78d77f178deb7a458235132d1fc8c44d0afe.tar.bz2
mtest: cleanup and fix print_stats
Avoid calling self.collected_failures.append twice, and avoid inflated indentation by adding a "plain" decorator to mlog. Fixes: ba71fde18 ("mtest: collect failures regardless of colorized console", 2020-10-12)
Diffstat (limited to 'mesonbuild/mlog.py')
-rw-r--r--mesonbuild/mlog.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index eefb308..46e2de1 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -124,7 +124,7 @@ class AnsiDecorator:
def get_text(self, with_codes: bool) -> str:
text = self.text
- if with_codes:
+ if with_codes and self.code:
text = self.code + self.text + AnsiDecorator.plain_code
if self.quoted:
text = '"{}"'.format(text)
@@ -133,6 +133,9 @@ class AnsiDecorator:
def bold(text: str, quoted: bool = False) -> AnsiDecorator:
return AnsiDecorator(text, "\033[1m", quoted=quoted)
+def plain(text: str) -> AnsiDecorator:
+ return AnsiDecorator(text, "")
+
def red(text: str) -> AnsiDecorator:
return AnsiDecorator(text, "\033[1;31m")