mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
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>
This commit is contained in:
@@ -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):
|
||||
|
Reference in New Issue
Block a user