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/cit.py b/cit.py
index 177b7ed..2fc016a 100755
--- a/cit.py
+++ b/cit.py
@@ -14,6 +14,8 @@
# TODO(hinoka,iannucci): Pre-pack infra tools in cipd package with vpython spec.
+from __future__ import print_function
+
import argparse
import sys
import os
@@ -102,20 +104,20 @@
def usage():
infra_tools, cipd_tools = get_available_tools()
- print """usage: cit.py <name of tool> [args for tool]
+ print("""usage: cit.py <name of tool> [args for tool]
Wrapper for maintaining and calling tools in:
"infra.git/run.py infra.tools.*"
"infra.git/cipd/*"
- Available infra tools are:"""
+ Available infra tools are:""")
for tool in infra_tools:
- print ' * %s' % tool
+ print(' * %s' % tool)
- print """
- Available cipd tools are:"""
+ print("""
+ Available cipd tools are:""")
for tool in cipd_tools:
- print ' * %s' % tool
+ print(' * %s' % tool)
def run(args):
@@ -137,7 +139,7 @@
elif os.path.isfile(cipd_file) and is_exe(cipd_file):
cmd = [cipd_file]
else:
- print >>sys.stderr, 'Unknown tool "%s"' % tool_name
+ print('Unknown tool "%s"' % tool_name, file=sys.stderr)
return usage()
# Add the remaining arguments.