Earl Ou has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/35596 )
Change subject: scons: only wrap message with positive value
......................................................................
scons: only wrap message with positive value
In case we have small TTY, scons failed with wrong testwrap value. Fix
the issue.
Change-Id: I8ec1d55c6856c1e592a57a68067091b796ac84ae
---
M site_scons/gem5_scons/__init__.py
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/site_scons/gem5_scons/__init__.py
b/site_scons/gem5_scons/__init__.py
index 7fa8d3d..be5676d 100644
--- a/site_scons/gem5_scons/__init__.py
+++ b/site_scons/gem5_scons/__init__.py
@@ -161,18 +161,21 @@
def print_message(prefix, color, message, **kwargs):
# Precompute some useful values.
prefix_len = len(prefix)
- wrap_width = text_width - prefix_len
- padding = ' ' * prefix_len
+ if text_width > prefix_len:
+ wrap_width = text_width - prefix_len
+ padding = ' ' * prefix_len
- # First split on newlines.
- lines = message.split('\n')
- # Then wrap each line to the required width.
- wrapped_lines = []
- for line in lines:
- wrapped_lines.extend(textwrap.wrap(line, wrap_width))
- # Finally add the prefix and padding on extra lines, and glue it all
back
- # together.
- message = prefix + ('\n' + padding).join(wrapped_lines)
+ # First split on newlines.
+ lines = message.split('\n')
+ # Then wrap each line to the required width.
+ wrapped_lines = []
+ for line in lines:
+ wrapped_lines.extend(textwrap.wrap(line, wrap_width))
+ # Finally add the prefix and padding on extra lines, and glue it all
back
+ # together.
+ message = prefix + ('\n' + padding).join(wrapped_lines)
+ else:
+ message = prefix + message
# Add in terminal escape sequences.
message = color + termcap.Bold + message + termcap.Normal
# Actually print the message.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35596
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I8ec1d55c6856c1e592a57a68067091b796ac84ae
Gerrit-Change-Number: 35596
Gerrit-PatchSet: 1
Gerrit-Owner: Earl Ou <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s