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/clang_format.py b/clang_format.py
index 5e952fc..b7b60a8 100755
--- a/clang_format.py
+++ b/clang_format.py
@@ -9,6 +9,8 @@
sync Chrome, to platform-specific locations. This script knows how to locate
those tools, assuming the script is invoked from inside a Chromium checkout."""
+from __future__ import print_function
+
import gclient_paths
import os
import subprocess
@@ -63,7 +65,8 @@
# redirection can be a little opaque.
help_syntax = ('-h', '--help', '-help', '-help-list', '--help-list')
if any(match in args for match in help_syntax):
- print '\nDepot tools redirects you to the clang-format at:\n %s\n' % tool
+ print(
+ '\nDepot tools redirects you to the clang-format at:\n %s\n' % tool)
return subprocess.call([tool] + args)