summaryrefslogtreecommitdiff
path: root/src/python/m5/util/terminal.py
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-03-05 22:05:47 -0800
committerGabe Black <gabeblack@google.com>2018-03-06 23:39:01 +0000
commit0bb50e6745b35c785c4d8051eb43f6bc419fb924 (patch)
tree97dfd086d6e4b3f4252aec459091ff6dad19f2b6 /src/python/m5/util/terminal.py
parent10e5646dbbe46aa317ec568cb2a58968ca867575 (diff)
downloadgem5-0bb50e6745b35c785c4d8051eb43f6bc419fb924.tar.xz
scons: Switch from the print statement to the print function.
Starting with version 3, scons imposes using the print function instead of the print statement in code it processes. To get things building again, this change moves all python code within gem5 to use the function version. Another change by another author separately made this same change to the site_tools and site_init.py files. Change-Id: I2de7dc3b1be756baad6f60574c47c8b7e80ea3b0 Reviewed-on: https://gem5-review.googlesource.com/8761 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/python/m5/util/terminal.py')
-rw-r--r--src/python/m5/util/terminal.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/python/m5/util/terminal.py b/src/python/m5/util/terminal.py
index 6bf85f14d..9dc5d9850 100644
--- a/src/python/m5/util/terminal.py
+++ b/src/python/m5/util/terminal.py
@@ -26,6 +26,8 @@
#
# Author: Steve Reinhardt
+from __future__ import print_function
+
import sys
# Intended usage example:
@@ -36,7 +38,7 @@ import sys
# from m5.util.terminal import no_termcap as termcap
# else:
# from m5.util.terminal import tty_termcap as termcap
-# print termcap.Blue + "This could be blue!" + termcap.Normal
+# print(termcap.Blue + "This could be blue!" + termcap.Normal)
# ANSI color names in index order
color_names = "Black Red Green Yellow Blue Magenta Cyan".split()
@@ -105,18 +107,18 @@ def get_termcap(use_colors = None):
def test_termcap(obj):
for c_name in color_names:
c_str = getattr(obj, c_name)
- print c_str + c_name + obj.Normal
+ print(c_str + c_name + obj.Normal)
for attr_name in capability_names:
if attr_name == 'Normal':
continue
attr_str = getattr(obj, attr_name)
- print attr_str + c_str + attr_name + " " + c_name + obj.Normal
- print obj.Bold + obj.Underline + \
- c_name + "Bold Underline " + c + obj.Normal
+ print(attr_str + c_str + attr_name + " " + c_name + obj.Normal)
+ print(obj.Bold + obj.Underline +
+ c_name + "Bold Underline " + c + obj.Normal)
if __name__ == '__main__':
- print "=== termcap enabled ==="
+ print("=== termcap enabled ===")
test_termcap(termcap)
- print termcap.Normal
- print "=== termcap disabled ==="
+ print(termcap.Normal)
+ print("=== termcap disabled ===")
test_termcap(no_termcap)