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:
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
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
get_maintainer = FindGetMaintainer()
if not get_maintainer:
if verbose:
- print "WARNING: Couldn't find get_maintainer.pl"
+ print("WARNING: Couldn't find get_maintainer.pl")
return []
stdout = command.Output(get_maintainer, '--norolestats', fname)
if raise_on_error:
raise OSError, msg
else:
- print col.Color(col.RED, msg)
+ print(col.Color(col.RED, msg))
return out_list
if lookup_name:
if raise_on_error:
raise ValueError, msg
else:
- print col.Color(col.RED, msg)
+ print(col.Color(col.RED, msg))
return out_list
for item in alias[lookup_name]:
todo = LookupEmail(item, alias, raise_on_error, level + 1)
if not new_item in out_list:
out_list.append(new_item)
- #print "No match for alias '%s'" % lookup_name
+ #print("No match for alias '%s'" % lookup_name)
return out_list
def GetTopLevel():
commit.patch = fname
result = FixPatch(backup_dir, fname, series, commit)
if result:
- print '%d warnings for %s:' % (len(result), fname)
+ print('%d warnings for %s:' % (len(result), fname))
for warn in result:
- print '\t', warn
+ print('\t', warn)
print
count += 1
- print 'Cleaned %d patches' % count
+ print('Cleaned %d patches' % count)
return series
def InsertCoverLetter(fname, series, count):
suite.run(result)
# TODO: Surely we can just 'print' result?
- print result
+ print(result)
for test, err in result.errors:
- print err
+ print(err)
for test, err in result.failures:
- print err
+ print(err)
# Called from git with a patch filename as argument
# Printout a list of additional CC recipients for this patch
for cc in match.group(2).split(', '):
cc = cc.strip()
if cc:
- print cc
+ print(cc)
fd.close()
elif options.full_help:
options.dry_run, not options.ignore_bad_tags, cc_file,
in_reply_to=options.in_reply_to, thread=options.thread)
else:
- print col.Color(col.RED, "Not sending emails due to errors/warnings")
+ print(col.Color(col.RED, "Not sending emails due to errors/warnings"))
# For a dry run, just show our actions as a sanity check
if options.dry_run:
series.ShowActions(args, cmd, options.process_tags)
if not its_a_go:
- print col.Color(col.RED, "Email would not be sent")
+ print(col.Color(col.RED, "Email would not be sent"))
os.remove(cc_file)
# SPDX-License-Identifier: GPL-2.0+
#
+from __future__ import print_function
+
import itertools
import os
cc_set = set(gitutil.BuildEmailList(self.cc));
col = terminal.Color()
- print 'Dry run, so not doing much. But I would do this:'
- print
- print 'Send a total of %d patch%s with %scover letter.' % (
+ print('Dry run, so not doing much. But I would do this:')
+ print()
+ print('Send a total of %d patch%s with %scover letter.' % (
len(args), '' if len(args) == 1 else 'es',
- self.get('cover') and 'a ' or 'no ')
+ self.get('cover') and 'a ' or 'no '))
# TODO: Colour the patches according to whether they passed checks
for upto in range(len(args)):
commit = self.commits[upto]
- print col.Color(col.GREEN, ' %s' % args[upto])
+ print(col.Color(col.GREEN, ' %s' % args[upto]))
cc_list = list(self._generated_cc[commit.patch])
for email in set(cc_list) - to_set - cc_set:
if email == None:
email = col.Color(col.YELLOW, "<alias '%s' not found>"
% tag)
if email:
- print ' Cc: ',email
+ print(' Cc: ', email)
print
for item in to_set:
- print 'To:\t ', item
+ print('To:\t ', item)
for item in cc_set - to_set:
- print 'Cc:\t ', item
- print 'Version: ', self.get('version')
- print 'Prefix:\t ', self.get('prefix')
+ print('Cc:\t ', item)
+ print('Version: ', self.get('version'))
+ print('Prefix:\t ', self.get('prefix'))
if self.cover:
- print 'Cover: %d lines' % len(self.cover)
+ print('Cover: %d lines' % len(self.cover))
cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
all_ccs = itertools.chain(cover_cc, *self._generated_cc.values())
for email in set(all_ccs) - to_set - cc_set:
- print ' Cc: ',email
+ print(' Cc: ', email)
if cmd:
- print 'Git command: %s' % cmd
+ print('Git command: %s' % cmd)
def MakeChangeLog(self, commit):
"""Create a list of changes for each version.
else:
if version > 1:
str = 'Change log missing for v%d' % version
- print col.Color(col.RED, str)
+ print(col.Color(col.RED, str))
for version in changes_copy:
str = 'Change log for unknown version v%d' % version
- print col.Color(col.RED, str)
+ print(col.Color(col.RED, str))
elif self.changes:
str = 'Change log exists, but no version is set'
- print col.Color(col.RED, str)
+ print(col.Color(col.RED, str))
def MakeCcFile(self, process_tags, cover_fname, raise_on_error,
add_maintainers):
if add_maintainers:
list += get_maintainer.GetMaintainer(commit.patch)
all_ccs += list
- print >>fd, commit.patch, ', '.join(set(list))
+ print(commit.patch, ', '.join(set(list)), file=fd)
self._generated_cc[commit.patch] = list
if cover_fname:
cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
- print >>fd, cover_fname, ', '.join(set(cover_cc + all_ccs))
+ print(cover_fname, ', '.join(set(cover_cc + all_ccs)), file=fd)
fd.close()
return fname
# SPDX-License-Identifier: GPL-2.0+
#
+from __future__ import print_function
+
import ConfigParser
import os
import re
try:
fd = open(fname, 'r')
except IOError:
- print "Warning: Cannot find alias file '%s'" % fname
+ print("Warning: Cannot find alias file '%s'" % fname)
return
re_line = re.compile('alias\s+(\S+)\s+(.*)')
m = re_line.match(line)
if not m:
- print "Warning: Alias file line '%s' not understood" % line
+ print("Warning: Alias file line '%s' not understood" % line)
continue
list = alias.get(m.group(1), [])
try:
f = open(config_fname, 'w')
except IOError:
- print "Couldn't create patman config file\n"
+ print("Couldn't create patman config file\n")
raise
- print >>f, "[alias]\nme: %s <%s>" % (name, email)
+ print("[alias]\nme: %s <%s>" % (name, email), file=f)
f.close();
def _UpdateDefaults(parser, config):
val = config.getint('settings', name)
parser.set_default(name, val)
else:
- print "WARNING: Unknown setting %s" % name
+ print("WARNING: Unknown setting %s" % name)
def _ReadAliasFile(fname):
"""Read in the U-Boot git alias file if it exists.
continue
alias[words[1]] = [s.strip() for s in words[2].split(',')]
if bad_line:
- print bad_line
+ print(bad_line)
def Setup(parser, project_name, config_fname=''):
"""Set up the settings module by reading config files.
config_fname = '%s/.patman' % os.getenv('HOME')
if not os.path.exists(config_fname):
- print "No config file found ~/.patman\nCreating one...\n"
+ print("No config file found ~/.patman\nCreating one...\n")
CreatePatmanConfigFile(config_fname)
config.read(config_fname)
This module handles terminal interaction including ANSI color codes.
"""
+from __future__ import print_function
+
import os
import sys
if colour:
col = Color()
text = col.Color(colour, text)
- print text,
+ print(text, end='')
if newline:
- print
+ print()
else:
sys.stdout.flush()
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):
elif data_type == 'indent':
indent = tab
else:
- print 'not implemented'
+ print('not implemented')
return data % (signoff, tab, indent, tab)
def SetupData(self, data_type):