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>
changes/72/3282072/2
Andrew Grieve 3 years ago committed by LUCI CQ
parent 7b33514431
commit b9e694ce13

@ -5263,10 +5263,10 @@ def CMDformat(parser, args):
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]

Loading…
Cancel
Save