Make "git cl format" use Python 3 by default
Chrome is far enough though its Py2->Py3 transition that it makes sense
to change the default here. The default is used whenever a .py file does
not have a shebang at the top of it.
Bug: 1062053
Change-Id: Ie8472f751c1366248d7797a0aaae36c836d9c426
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3282072
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
diff --git a/git_cl.py b/git_cl.py
index 1ae46c6..fedd53e 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -5263,10 +5263,10 @@
yapf_style = 'pep8'
with open(f, 'r') as py_f:
- if 'python3' in py_f.readline():
- vpython_script = 'vpython3'
- else:
+ if 'python2' in py_f.readline():
vpython_script = 'vpython'
+ else:
+ vpython_script = 'vpython3'
cmd = [vpython_script, yapf_tool, '--style', yapf_style, f]