Fix re compilation of presubmit.py
Some presubmit regex needs to be escaped by r, otherwise python can not compile them. Python 3.12 has mad these into warnings and they're flooding the presubmit messages. Bug: 397963615 Change-Id: I5ddcb9cf1744438d163e6b25636e6861e665d7bd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6305727 Reviewed-by: Dirk Pranke <dpranke@google.com> Reviewed-by: Gary Tong <gatong@chromium.org> Commit-Queue: Riley Wong <rgw@google.com> Cr-Commit-Position: refs/heads/main@{#1425455}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
10b5ac1999
commit
49be8a887f
@ -475,7 +475,7 @@ _BANNED_IOS_OBJC_FUNCTIONS = (
|
||||
'ios/chrome/common',
|
||||
# App extensions have restricted dependencies and thus can't use the
|
||||
# wrappers.
|
||||
'^ios/chrome/\w+_extension/',
|
||||
r'^ios/chrome/\w+_extension/',
|
||||
),
|
||||
),
|
||||
BanRule(
|
||||
@ -2636,7 +2636,7 @@ def _CheckNoUNIT_TESTInSourceFiles(input_api, f):
|
||||
problems = []
|
||||
|
||||
unit_test_macro = input_api.re.compile(
|
||||
'^\s*#.*(?:ifn?def\s+UNIT_TEST|defined\s*\(?\s*UNIT_TEST\s*\)?)(?:$|\s+)')
|
||||
r'^\s*#.*(?:ifn?def\s+UNIT_TEST|defined\s*\(?\s*UNIT_TEST\s*\)?)(?:$|\s+)')
|
||||
for line_num, line in f.ChangedContents():
|
||||
if unit_test_macro.match(line):
|
||||
problems.append(' %s:%d' % (f.LocalPath(), line_num))
|
||||
@ -2986,7 +2986,7 @@ def CheckNoBannedFunctions(input_api, output_api):
|
||||
# As of 05/2024, iOS fully migrated ConsentLevel::kSync to kSignin, and
|
||||
# Android is in the process of preventing new users from entering kSync.
|
||||
# So the warning is restricted to those platforms.
|
||||
ios_pattern = input_api.re.compile('(^|[\W_])ios[\W_]')
|
||||
ios_pattern = input_api.re.compile(r'(^|[\W_])ios[\W_]')
|
||||
file_filter = lambda f: (f.LocalPath().endswith(('.cc', '.mm', '.h')) and
|
||||
('android' in f.LocalPath() or
|
||||
# Simply checking for an 'ios' substring would
|
||||
|
Reference in New Issue
Block a user