summaryrefslogtreecommitdiff
path: root/tools/patman/terminal.py
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2016-09-27 18:03:50 +0300
committersjg <sjg@chromium.org>2016-10-09 18:30:32 +0300
commita920a17b2f418535870788ae81234dc6b8aa6661 (patch)
tree2986de030de65467a4830c6fafb79d5e142b7729 /tools/patman/terminal.py
parent12e5476df33a24ff781e6f78404792e4b8596c28 (diff)
downloadu-boot-a920a17b2f418535870788ae81234dc6b8aa6661.tar.xz
patman: Make print statements python 3.x safe
In python 3.x, print must be used as a function call. Convert all print statements to the function call style, importing from __future__ where we print with no trailing newline or print to a file object. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/terminal.py')
-rw-r--r--tools/patman/terminal.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py
index af3593eb34..137265fc81 100644
--- a/tools/patman/terminal.py
+++ b/tools/patman/terminal.py
@@ -8,6 +8,8 @@
This module handles terminal interaction including ANSI color codes.
"""
+from __future__ import print_function
+
import os
import sys
@@ -52,9 +54,9 @@ def Print(text='', newline=True, colour=None):
if colour:
col = Color()
text = col.Color(colour, text)
- print text,
+ print(text, end='')
if newline:
- print
+ print()
else:
sys.stdout.flush()
@@ -81,11 +83,11 @@ def EchoPrintTestLines():
for line in print_test_list:
if line.colour:
col = Color()
- print col.Color(line.colour, line.text),
+ print(col.Color(line.colour, line.text), end='')
else:
- print line.text,
+ print(line.text, end='')
if line.newline:
- print
+ print()
class Color(object):