Properly run Python scripts on Windows in presubmit checks.
Call the python executable instead of trying to run a .py file directly.
Bug: pdfium:1365
Change-Id: Iebccb4aeb8efdca4cdcbc66d82cd7362644a2dbd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/57910
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/PRESUBMIT.py b/fpdfsdk/PRESUBMIT.py
index a74a4e5..e844ec3 100644
--- a/fpdfsdk/PRESUBMIT.py
+++ b/fpdfsdk/PRESUBMIT.py
@@ -14,14 +14,15 @@
def _CheckApiTestFile(input_api, output_api):
"""Checks that the public headers match the API tests."""
- src_path = input_api.os_path.dirname(input_api.PresubmitLocalPath())
if all([not _IsApiTestFile(f) for f in input_api.AffectedSourceFiles([])]):
return []
+ src_path = input_api.os_path.dirname(input_api.PresubmitLocalPath())
check_script = input_api.os_path.join(
src_path, 'testing' , 'tools' , 'api_check.py')
+ cmd = [input_api.python_executable, check_script]
try:
- input_api.subprocess.check_output(check_script)
+ input_api.subprocess.check_output(cmd)
return []
except input_api.subprocess.CalledProcessError as error:
return [output_api.PresubmitError('api_check.py failed:',
diff --git a/public/PRESUBMIT.py b/public/PRESUBMIT.py
index 35bd873..5081823 100644
--- a/public/PRESUBMIT.py
+++ b/public/PRESUBMIT.py
@@ -13,8 +13,9 @@
src_path = input_api.os_path.dirname(input_api.PresubmitLocalPath())
check_script = input_api.os_path.join(
src_path, 'testing' , 'tools' , 'api_check.py')
+ cmd = [input_api.python_executable, check_script]
try:
- input_api.subprocess.check_output(check_script)
+ input_api.subprocess.check_output(cmd)
return []
except input_api.subprocess.CalledProcessError as error:
return [output_api.PresubmitError('api_check.py failed:',