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/annotated_gclient.py b/annotated_gclient.py
index 61e0b5d..f985007 100755
--- a/annotated_gclient.py
+++ b/annotated_gclient.py
@@ -12,6 +12,8 @@
sync --gclientfile=.gclient`
"""
+from __future__ import print_function
+
import contextlib
import json
import optparse
@@ -31,7 +33,7 @@
try:
os.remove(output_file)
except OSError as e:
- print 'Error cleaning up temp file %s: %s' % (output_file, e)
+ print('Error cleaning up temp file %s: %s' % (output_file, e))
def parse_got_revision(filename, revision_mapping):
@@ -51,7 +53,7 @@
def emit_buildprops(got_revisions):
for prop, revision in got_revisions.iteritems():
- print '@@@SET_BUILD_PROPERTY@%s@%s@@@' % (prop, json.dumps(revision))
+ print('@@@SET_BUILD_PROPERTY@%s@%s@@@' % (prop, json.dumps(revision)))
def main():