summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-06-06 17:36:53 +0100
committerbst-marge-bot <marge-bot@buildstream.build>2019-06-18 09:45:00 +0000
commita65b589b8577291185482cca51733f603a83ef1b (patch)
treeafc5c00544f43fb8c1bc3f5ae2918bfed5184db2
parent405e0f3b98ccc84c77dc8d68691e277bf82ae495 (diff)
downloadbuildstream-a65b589b8577291185482cca51733f603a83ef1b.tar.gz
_frontend/widget: match LogFile.render to base cls
Make the signature of LogFile.render() match Widget.render() by making a new LogFile.render_abbrev() method with the extra functionality. Fix up the single call site to use that instead. This means that we won't get linter warnings that helpful inform us that Widgets are not really substitutable.
-rw-r--r--src/buildstream/_frontend/widget.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/buildstream/_frontend/widget.py b/src/buildstream/_frontend/widget.py
index cdef589b7..dce63e14f 100644
--- a/src/buildstream/_frontend/widget.py
+++ b/src/buildstream/_frontend/widget.py
@@ -253,8 +253,10 @@ class LogFile(Widget):
self._err_profile = err_profile
self._logdir = context.logdir
- def render(self, message, abbrev=True):
+ def render(self, message):
+ return self.render_abbrev(message)
+ def render_abbrev(self, message, abbrev=True):
if message.logfile and message.scheduler:
logfile = message.logfile
@@ -285,7 +287,7 @@ class MessageOrLogFile(Widget):
def render(self, message):
# Show the log file only in the main start/success messages
if message.logfile and message.scheduler and \
- message.message_type in [MessageType.START, MessageType.SUCCESS]:
+ message.message_type in [MessageType.START, MessageType.SUCCESS]:
text = self._logfile_widget.render(message)
else:
text = self._message_widget.render(message)
@@ -709,7 +711,7 @@ class LogLine(Widget):
elif self._log_lines > 0:
text += self._indent + self._err_profile.fmt("Printing the last {} lines from log file:"
.format(self._log_lines)) + '\n'
- text += self._indent + self._logfile_widget.render(message, abbrev=False) + '\n'
+ text += self._indent + self._logfile_widget.render_abbrev(message, abbrev=False) + '\n'
text += self._indent + self._err_profile.fmt("=" * 70) + '\n'
log_content = self._read_last_lines(message.logfile)