Reland "Remove Python 2 support for PRESUBMIT.py"
This is a reland of commit 8454fc2458b2421e0e339714c6ff7e6fffb70dc4
Original change's description:
> Remove Python 2 support for PRESUBMIT.py
>
> The presubmit system still supports invoking PRESUBMIT.py files using
> Python 2. This has recently been turned off on the bots so this change
> removes support more completely.
>
> There are still some python3 parameters being passed around - it seemed
> better to do the simplest possible removal now, with a follow-up change
> to remove more support code after this has sat for a while.
>
> Tests run from PRESUBMIT.py files could still be run using Python 2, but
> those should also have been addressed already. Removing support for that
> will be done in a subsequent change.
>
> Bug: 1207012
> Change-Id: Id244d547a04438f83734dba269c3cc180c148b37
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4315183
> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
> Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Bug: 1207012
Change-Id: If542cac21d8ec8704b28d03fd8407c5c2899ca2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4317177
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 51a5708..dae123d 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1435,21 +1435,11 @@
' was not specified. To enable ResultDB, please run the command'
' again with the --realm argument to specify the LUCI realm.')
- py3_results = self._RunPresubmit(args,
- description,
- use_python3=True,
- resultdb=resultdb,
- realm=realm)
- if py3_results.get('skipped_presubmits', 1) == 0:
- print('No more presubmits to run - skipping Python 2 presubmits.')
- return py3_results
-
- py2_results = self._RunPresubmit(args,
- description,
- use_python3=False,
- resultdb=resultdb,
- realm=realm)
- return self._MergePresubmitResults(py2_results, py3_results)
+ return self._RunPresubmit(args,
+ description,
+ use_python3=True,
+ resultdb=resultdb,
+ realm=realm)
def _RunPresubmit(self,
args,
@@ -1489,19 +1479,6 @@
json_results = gclient_utils.FileRead(json_output)
return json.loads(json_results)
- def _MergePresubmitResults(self, py2_results, py3_results):
- return {
- 'more_cc': sorted(set(py2_results.get('more_cc', []) +
- py3_results.get('more_cc', []))),
- 'errors': (
- py2_results.get('errors', []) + py3_results.get('errors', [])),
- 'notifications': (
- py2_results.get('notifications', []) +
- py3_results.get('notifications', [])),
- 'warnings': (
- py2_results.get('warnings', []) + py3_results.get('warnings', []))
- }
-
def RunPostUploadHook(self, verbose, upstream, description, py3_only):
args = self._GetCommonPresubmitArgs(verbose, upstream)
args.append('--post_upload')
@@ -1509,13 +1486,8 @@
with gclient_utils.temporary_file() as description_file:
gclient_utils.FileWrite(description_file, description)
args.extend(['--description_file', description_file])
- if not py3_only:
- p_py2 = subprocess2.Popen(['vpython', PRESUBMIT_SUPPORT] + args)
- p_py3 = subprocess2.Popen(['vpython3', PRESUBMIT_SUPPORT] + args +
- ['--use-python3'])
- if not py3_only:
- p_py2.wait()
- p_py3.wait()
+ subprocess2.Popen(['vpython3', PRESUBMIT_SUPPORT] + args +
+ ['--use-python3']).wait()
def _GetDescriptionForUpload(self, options, git_diff_args, files):
# type: (optparse.Values, Sequence[str], Sequence[str]