Commit 56add621 authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

Fix autoninja.py's regex string

Regex strings need to be raw or else double-escape all the \ characters,
but Python 2.7 doesn't reliably enforce this, so bugs have crept in.

The buggy regex from create_installer_archive.py that this was copied
from was deleted a while ago. However this bad pattern is pervasive in
Chrome and depot_tools, as crudely found by searching for:

  re\.[a-z]*\('.*\\[dsw\(\.]

An earlier instance of this was found when running some of our scripts
with Python 3.8.

Bug: 958138
Change-Id: If7ded5ae13f8cc36a5f6277c6ae0a2f54f88c3e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1590191Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
parent f61af569
......@@ -60,7 +60,7 @@ try:
with open(os.path.join(output_dir, 'args.gn')) as file_handle:
for line in file_handle:
# This regex pattern copied from create_installer_archive.py
m = re.match('^\s*use_goma\s*=\s*true(\s*$|\s*#.*$)', line)
m = re.match(r'^\s*use_goma\s*=\s*true(\s*$|\s*#.*$)', line)
if m:
use_goma = True
except IOError:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment