Use Python 3 from ./PRESUBMIT.py
The root directory PRESUBMIT.py is run using Python 3, but it invokes
other scripts and it was running two of them using python_executable
instead of python3_executable. This change fixes that.
checkperms.py had to be updated because the filter command returns an
iterable object instead of a list. Converting it to a list ensures that
an empty list will be False, as opposed to the object which is always
True. I fixed this on one code path a year ago (crrev.com/c/2806723)
but now the fix covers all paths.
This was tested (on Linux) with the following command:
git cl presubmit --files=PRESUBMIT.py
Bug: 1313804
Change-Id: I1c8a0d1e5e888b9e7ee6cfcbeb218b0fb9aaad6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3643458
Auto-Submit: Bruce Dawson <[email protected]>
Commit-Queue: Lei Zhang <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1003172}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index be65042..b82eef6 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1593,7 +1593,7 @@
'third_party', 'depot_tools',
'gclient.py')
input_api.subprocess.check_output(
- [input_api.python_executable, gclient_path, 'verify'],
+ [input_api.python3_executable, gclient_path, 'verify'],
stderr=input_api.subprocess.STDOUT)
return []
except input_api.subprocess.CalledProcessError as error:
@@ -1903,7 +1903,7 @@
'tools', 'checkperms',
'checkperms.py')
args = [
- input_api.python_executable, checkperms_tool, '--root',
+ input_api.python3_executable, checkperms_tool, '--root',
input_api.change.RepositoryRoot()
]
with input_api.CreateTemporaryFile() as file_list: