Commit ec92099a authored by Marc-Antoine Ruel's avatar Marc-Antoine Ruel Committed by Commit Bot

Switch all 'python' strings to input_api.python_executable in PRESUBMIT.py

This guarantees that the same python runtime is used throughput the presubmit
checks. This also saves an unnecessary cmd.exe process on Windows, which saves a
few ms.

TBR=vadimsh@chromium.org
BUG=761523

Change-Id: I32ef6966fbd33835ec9d4d9d4a9628d759c86884
Reviewed-on: https://chromium-review.googlesource.com/648446Reviewed-by: default avatarVadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Marc-Antoine Ruel <maruel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#499496}
parent e2b5e999
......@@ -8,8 +8,6 @@ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit API.
"""
import subprocess
def CheckChangeOnUpload(input_api, output_api):
return _CommonChecks(input_api, output_api)
......@@ -26,13 +24,15 @@ def _CommonChecks(input_api, output_api):
results.extend(_RunPyLint(input_api, output_api))
return results
def _RunUnitTests(input_api, output_api):
"""Runs unit tests for checkteamtags."""
repo_root = input_api.change.RepositoryRoot()
checkteamtags_dir = input_api.os_path.join(repo_root, 'tools',
'checkteamtags')
test_runner = input_api.os_path.join(checkteamtags_dir, 'run_tests')
return_code = subprocess.call(['python', test_runner])
return_code = input_api.subprocess.call(
[input_api.python_executable, test_runner])
if return_code:
message = 'Checkteamtags unit tests did not all pass.'
return [output_api.PresubmitError(message)]
......
......@@ -17,7 +17,8 @@ def CheckChange(input_api, output_api):
and input_api.os_path.dirname(p) == input_api.PresubmitLocalPath()):
cwd = input_api.os_path.dirname(p)
exit_code = input_api.subprocess.call(
['python', 'extract_actions.py', '--presubmit'], cwd=cwd)
[input_api.python_executable, 'extract_actions.py', '--presubmit'],
cwd=cwd)
if exit_code != 0:
return [output_api.PresubmitError(
'actions.xml is not up to date or is not formatted correctly; '
......
......@@ -25,7 +25,8 @@ def CheckChange(input_api, output_api):
cwd = input_api.PresubmitLocalPath()
exit_code = input_api.subprocess.call(
['python', 'pretty_print.py', '--presubmit', '--non-interactive'],
[input_api.python_executable, 'pretty_print.py', '--presubmit',
'--non-interactive'],
cwd=cwd)
if exit_code != 0:
results.append(output_api.PresubmitError(
......@@ -33,7 +34,7 @@ def CheckChange(input_api, output_api):
'git cl format %s to fix.' % cwd))
exit_code = input_api.subprocess.call(
['python', 'validate_format.py'], cwd=cwd)
[input_api.python_executable, 'validate_format.py'], cwd=cwd)
if exit_code != 0:
results.append(output_api.PresubmitError(
'histograms.xml is not well formatted; run %s/validate_format.py '
......
......@@ -17,7 +17,8 @@ def CheckChange(input_api, output_api):
and input_api.os_path.dirname(p) == input_api.PresubmitLocalPath()):
cwd = input_api.os_path.dirname(p)
exit_code = input_api.subprocess.call(
['python', 'pretty_print.py', '--presubmit'], cwd=cwd)
[input_api.python_executable, 'pretty_print.py', '--presubmit'],
cwd=cwd)
if exit_code != 0:
return [output_api.PresubmitError(
'rappor.xml is not formatted correctly; run %s/pretty_print.py '
......
......@@ -19,7 +19,8 @@ def CheckChange(input_api, output_api):
and input_api.os_path.dirname(p) == input_api.PresubmitLocalPath()):
cwd = input_api.os_path.dirname(p)
exit_code = input_api.subprocess.call(
['python', 'pretty_print.py', '--presubmit'], cwd=cwd)
[input_api.python_executable, 'pretty_print.py', '--presubmit'],
cwd=cwd)
if exit_code != 0:
return [output_api.PresubmitError(
'%s is not formatted correctly; run %s/pretty_print.py to fix' %
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment