Skip to content

Commit f834d0a

Browse files
markmentovaigm4sl
authored andcommitted
Fix SyntaxWarning in build/run_tests.py
Use r-strings for all regular expressions. Fixes these warnings experienced with Python 3.12 (python/cpython#98401, python/cpython#99011, https://docs.python.org/3/whatsnew/3.12.html#other-language-changes point 2): run_tests.py:200: SyntaxWarning: invalid escape sequence '\d' FINAL_LINE_RE = re.compile('status=(\d+)$') run_tests.py:441: SyntaxWarning: invalid escape sequence '\*' re.match('^\* daemon .+ \*$', line) or line == ''): Change-Id: I71ddfb1a2ca62654378ae67a99e9aeb4ce7b7394 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6254063 Commit-Queue: Mark Mentovai <[email protected]> Reviewed-by: Nico Weber <[email protected]>
1 parent 9180cb9 commit f834d0a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

build/run_tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def _BinaryDirTargetOS(binary_dir):
7979
text=True)
8080
value = popen.communicate()[0]
8181
if popen.returncode == 0:
82-
match = re.match('target_os = "(.*)"$', value)
82+
match = re.match(r'target_os = "(.*)"$', value)
8383
if match:
8484
return match.group(1)
8585

@@ -89,7 +89,7 @@ def _BinaryDirTargetOS(binary_dir):
8989
if os.path.exists(build_ninja_path):
9090
with open(build_ninja_path) as build_ninja_file:
9191
build_ninja_content = build_ninja_file.read()
92-
match = re.search('-linux-android(eabi)?-ar$', build_ninja_content,
92+
match = re.search(r'-linux-android(eabi)?-ar$', build_ninja_content,
9393
re.MULTILINE)
9494
if match:
9595
return 'android'
@@ -197,7 +197,7 @@ def _adb_shell(command_args, env={}):
197197
stdout=subprocess.PIPE,
198198
text=True)
199199

200-
FINAL_LINE_RE = re.compile('status=(\d+)$')
200+
FINAL_LINE_RE = re.compile(r'status=(\d+)$')
201201
final_line = None
202202
while True:
203203
# Use readline so that the test output appears “live” when running.
@@ -438,7 +438,7 @@ def main(args):
438438
for line in adb_devices.splitlines():
439439
line = line
440440
if (line == 'List of devices attached' or
441-
re.match('^\* daemon .+ \*$', line) or line == ''):
441+
re.match(r'^\* daemon .+ \*$', line) or line == ''):
442442
continue
443443
(device, ignore) = line.split('\t')
444444
devices.append(device)

0 commit comments

Comments
 (0)