Force Python 3 in presubmit
BUG=tint:1020 Change-Id: I8c4dba4367076922bd4dd039b1d91960eaf224a3 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58940 Auto-Submit: Ryan Harrison <rharrison@chromium.org> Reviewed-by: James Price <jrprice@google.com> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
9889ff0bcd
commit
6d27f23451
33
PRESUBMIT.py
33
PRESUBMIT.py
|
@ -18,6 +18,8 @@ for more details about the presubmit API built into depot_tools.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
USE_PYTHON3 = True
|
||||||
|
|
||||||
|
|
||||||
def _LicenseHeader(input_api):
|
def _LicenseHeader(input_api):
|
||||||
"""Returns the license header regexp."""
|
"""Returns the license header regexp."""
|
||||||
|
@ -100,23 +102,26 @@ for reg in REGEXES:
|
||||||
REGEX_LIST.append(re.compile(reg))
|
REGEX_LIST.append(re.compile(reg))
|
||||||
|
|
||||||
def CheckNonInclusiveLanguage(input_api, output_api, source_file_filter=None):
|
def CheckNonInclusiveLanguage(input_api, output_api, source_file_filter=None):
|
||||||
"""Checks the files for non-inclusive language."""
|
"""Checks the files for non-inclusive language."""
|
||||||
|
|
||||||
matches = []
|
matches = []
|
||||||
for f in input_api.AffectedFiles(include_deletes=False,
|
for f in input_api.AffectedFiles(include_deletes=False,
|
||||||
file_filter=source_file_filter):
|
file_filter=source_file_filter):
|
||||||
for line_num, line in f.ChangedContents():
|
for line_num, line in f.ChangedContents():
|
||||||
for reg in REGEX_LIST:
|
for reg in REGEX_LIST:
|
||||||
match = reg.search(line)
|
match = reg.search(line)
|
||||||
if match:
|
if match:
|
||||||
matches.append("{} ({}): found non-inclusive language: {}".
|
matches.append(
|
||||||
format(f.LocalPath(), line_num, match.group(0)))
|
"{} ({}): found non-inclusive language: {}".format(
|
||||||
|
f.LocalPath(), line_num, match.group(0)))
|
||||||
|
|
||||||
if len(matches):
|
if len(matches):
|
||||||
return [output_api.PresubmitPromptWarning(
|
return [
|
||||||
'Non-inclusive language found:', items=matches)]
|
output_api.PresubmitPromptWarning('Non-inclusive language found:',
|
||||||
|
items=matches)
|
||||||
|
]
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def CheckChange(input_api, output_api):
|
def CheckChange(input_api, output_api):
|
||||||
|
|
Loading…
Reference in New Issue