diff options
author | Paul Burton <paul.burton@imgtec.com> | 2016-09-27 16:03:50 +0100 |
---|---|---|
committer | sjg <sjg@chromium.org> | 2016-10-09 09:30:32 -0600 |
commit | a920a17b2f418535870788ae81234dc6b8aa6661 (patch) | |
tree | 2986de030de65467a4830c6fafb79d5e142b7729 /tools/patman/series.py | |
parent | 12e5476df33a24ff781e6f78404792e4b8596c28 (diff) | |
download | u-boot-a920a17b2f418535870788ae81234dc6b8aa6661.zip u-boot-a920a17b2f418535870788ae81234dc6b8aa6661.tar.gz u-boot-a920a17b2f418535870788ae81234dc6b8aa6661.tar.bz2 |
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/series.py')
-rw-r--r-- | tools/patman/series.py | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/tools/patman/series.py b/tools/patman/series.py index 1ce30c6..38a452e 100644 --- a/tools/patman/series.py +++ b/tools/patman/series.py @@ -3,6 +3,8 @@ # SPDX-License-Identifier: GPL-2.0+ # +from __future__ import print_function + import itertools import os @@ -101,38 +103,38 @@ class Series(dict): 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. @@ -191,13 +193,13 @@ class Series(dict): 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): @@ -228,12 +230,12 @@ class Series(dict): 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 |