
presubmit now uses python3 only. This is generated by $ rg -l '^USE_PYTHON3 = True' | \ xargs sed -z -i "s/\n*USE_PYTHON3 = True\n*/\n\n/" with some more modifications. This also removes run_on_python2, run_on_python3, and skip_shebang_check args. Bug: 1207012 Change-Id: I34707fe17f320fc147163f8210188328ad339d78 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4576821 Auto-Submit: Takuto Ikuta <tikuta@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org> Cr-Commit-Position: refs/heads/main@{#1152169}
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
# Copyright 2019 The Chromium Authors
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
def CheckChangeOnUpload(input_api, output_api):
|
|
return _CommonChecks(input_api, output_api)
|
|
|
|
|
|
def CheckChangeOnCommit(input_api, output_api):
|
|
return _CommonChecks(input_api, output_api)
|
|
|
|
|
|
def _CheckSvgsOptimized(input_api, output_api):
|
|
results = []
|
|
try:
|
|
import sys
|
|
old_sys_path = sys.path[:]
|
|
cwd = input_api.PresubmitLocalPath()
|
|
sys.path += [input_api.os_path.join(cwd, '..', 'tools')]
|
|
from resources import svgo_presubmit
|
|
results += svgo_presubmit.CheckOptimized(input_api, output_api)
|
|
finally:
|
|
sys.path = old_sys_path
|
|
return results
|
|
|
|
|
|
def _CheckWebDevStyle(input_api, output_api):
|
|
results = []
|
|
try:
|
|
import sys
|
|
old_sys_path = sys.path[:]
|
|
cwd = input_api.PresubmitLocalPath()
|
|
sys.path += [input_api.os_path.join(cwd, '..', 'tools')]
|
|
from web_dev_style import presubmit_support
|
|
results += presubmit_support.CheckStyle(input_api, output_api)
|
|
finally:
|
|
sys.path = old_sys_path
|
|
return results
|
|
|
|
|
|
def _CommonChecks(input_api, output_api):
|
|
results = []
|
|
results += _CheckSvgsOptimized(input_api, output_api)
|
|
results += _CheckWebDevStyle(input_api, output_api)
|
|
results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api,
|
|
check_js=True)
|
|
return results
|