Convert print statements to Python 3 style
Ran "2to3 -w -n -f print ./" and manually added imports.
Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually.
Also manually added imports to files, which used print as a function, but were missing the import.
The scripts still work with Python 2.
There are no intended behaviour changes.
Bug: 942522
Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
diff --git a/git_find_releases.py b/git_find_releases.py
index ef65c0e..cab723d 100755
--- a/git_find_releases.py
+++ b/git_find_releases.py
@@ -11,6 +11,8 @@
only work on merges that followed the "use cherry-pick -x" instructions.
"""
+from __future__ import print_function
+
import optparse
import re
import sys
@@ -43,16 +45,16 @@
for arg in args:
commit_name = GetNameForCommit(arg)
if not commit_name:
- print '%s not found' % arg
+ print('%s not found' % arg)
return 1
- print 'commit %s was:' % arg
- print ' initially in ' + commit_name
+ print('commit %s was:' % arg)
+ print(' initially in ' + commit_name)
merges = GetMergesForCommit(arg)
for merge in merges:
- print ' merged to ' + GetNameForCommit(merge) + ' (as ' + merge + ')'
+ print(' merged to ' + GetNameForCommit(merge) + ' (as ' + merge + ')')
if not merges:
- print 'No merges found. If this seems wrong, be sure that you did:'
- print ' git fetch origin && gclient sync --with_branch_heads'
+ print('No merges found. If this seems wrong, be sure that you did:')
+ print(' git fetch origin && gclient sync --with_branch_heads')
return 0