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:
@@ -83,7 +83,7 @@ def CheckPatch(fname, verbose=False):
|
||||
|
||||
for line in result.stdout.splitlines():
|
||||
if verbose:
|
||||
print line
|
||||
print(line)
|
||||
|
||||
# A blank line indicates the end of a message
|
||||
if not line and item:
|
||||
@@ -151,17 +151,17 @@ def CheckPatches(verbose, args):
|
||||
error_count += result.errors
|
||||
warning_count += result.warnings
|
||||
check_count += result.checks
|
||||
print '%d errors, %d warnings, %d checks for %s:' % (result.errors,
|
||||
result.warnings, result.checks, col.Color(col.BLUE, fname))
|
||||
print('%d errors, %d warnings, %d checks for %s:' % (result.errors,
|
||||
result.warnings, result.checks, col.Color(col.BLUE, fname)))
|
||||
if (len(result.problems) != result.errors + result.warnings +
|
||||
result.checks):
|
||||
print "Internal error: some problems lost"
|
||||
print("Internal error: some problems lost")
|
||||
for item in result.problems:
|
||||
print GetWarningMsg(col, item.get('type', '<unknown>'),
|
||||
print(GetWarningMsg(col, item.get('type', '<unknown>'),
|
||||
item.get('file', '<unknown>'),
|
||||
item.get('line', 0), item.get('msg', 'message'))
|
||||
item.get('line', 0), item.get('msg', 'message')))
|
||||
print
|
||||
#print stdout
|
||||
#print(stdout)
|
||||
if error_count or warning_count or check_count:
|
||||
str = 'checkpatch.pl found %d error(s), %d warning(s), %d checks(s)'
|
||||
color = col.GREEN
|
||||
@@ -169,6 +169,6 @@ def CheckPatches(verbose, args):
|
||||
color = col.YELLOW
|
||||
if error_count:
|
||||
color = col.RED
|
||||
print col.Color(color, str % (error_count, warning_count, check_count))
|
||||
print(col.Color(color, str % (error_count, warning_count, check_count)))
|
||||
return False
|
||||
return True
|
||||
|
Reference in New Issue
Block a user