From 6d27f2345111096abc0cb5e2831a4167dabfa49f Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Tue, 20 Jul 2021 17:16:31 +0000 Subject: [PATCH] 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 Reviewed-by: James Price Commit-Queue: Ryan Harrison Kokoro: Kokoro --- PRESUBMIT.py | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 1d40742dc0..7e019b76b6 100755 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -18,6 +18,8 @@ for more details about the presubmit API built into depot_tools. import re +USE_PYTHON3 = True + def _LicenseHeader(input_api): """Returns the license header regexp.""" @@ -100,23 +102,26 @@ for reg in REGEXES: REGEX_LIST.append(re.compile(reg)) 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 = [] - for f in input_api.AffectedFiles(include_deletes=False, - file_filter=source_file_filter): - for line_num, line in f.ChangedContents(): - for reg in REGEX_LIST: - match = reg.search(line) - if match: - matches.append("{} ({}): found non-inclusive language: {}". - format(f.LocalPath(), line_num, match.group(0))) + matches = [] + for f in input_api.AffectedFiles(include_deletes=False, + file_filter=source_file_filter): + for line_num, line in f.ChangedContents(): + for reg in REGEX_LIST: + match = reg.search(line) + if match: + matches.append( + "{} ({}): found non-inclusive language: {}".format( + f.LocalPath(), line_num, match.group(0))) - if len(matches): - return [output_api.PresubmitPromptWarning( - 'Non-inclusive language found:', items=matches)] + if len(matches): + return [ + output_api.PresubmitPromptWarning('Non-inclusive language found:', + items=matches) + ] - return [] + return [] def CheckChange(input_api, output_api):