From cecd1d864fc3cf02cf50d367111e0d0e173c5dc6 Mon Sep 17 00:00:00 2001 From: Sarah Owens Date: Thu, 1 Nov 2012 22:59:27 -0700 Subject: Change print statements to work in python3 This is part of a series of changes to introduce Python3 support. Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32 --- project.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'project.py') diff --git a/project.py b/project.py index f72b1c8e..20a8dca4 100644 --- a/project.py +++ b/project.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import print_function import traceback import errno import filecmp @@ -50,7 +51,7 @@ def _lwrite(path, content): def _error(fmt, *args): msg = fmt % args - print >>sys.stderr, 'error: %s' % msg + print('error: %s' % msg, file=sys.stderr) def not_rev(r): return '^' + r @@ -683,9 +684,9 @@ class Project(object): if not os.path.isdir(self.worktree): if output_redir == None: output_redir = sys.stdout - print >>output_redir, '' - print >>output_redir, 'project %s/' % self.relpath - print >>output_redir, ' missing (run "repo sync")' + print(file=output_redir) + print('project %s/' % self.relpath, file=output_redir) + print(' missing (run "repo sync")', file=output_redir) return self.work_git.update_index('-q', @@ -785,7 +786,7 @@ class Project(object): out.project('project %s/' % self.relpath) out.nl() has_diff = True - print line[:-1] + print(line[:-1]) p.Wait() @@ -1586,7 +1587,8 @@ class Project(object): # returned another error with the HTTP error code being 400 or above. # This return code only appears if -f, --fail is used. if not quiet: - print >> sys.stderr, "Server does not provide clone.bundle; ignoring." + print("Server does not provide clone.bundle; ignoring.", + file=sys.stderr) return False if os.path.exists(tmpPath): -- cgit v1.2.3-54-g00ecf