Revert "Try again to fix UnicodeDecodeError in CheckAuthorizedAuthor."

This reverts commit dd0076703b.

Reason for revert: Change wasn't correct.

Original change's description:
> Try again to fix UnicodeDecodeError in CheckAuthorizedAuthor.
>
> This will attempt to do so in a Python2-compatible way.
>
> Bug: 1210746
> Change-Id: I09edc21a5c47106803c0ac5ca449e0f8732efb24
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2906501
> Auto-Submit: Dirk Pranke <dpranke@google.com>
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Bug: 1210746
Change-Id: Ia101d73857abe3d65ba48e05e7a0bc98efb2fd37
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2908152
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
changes/52/2908152/2
Dirk Pranke 4 years ago committed by LUCI CQ
parent 259f77738f
commit 3e9eda1734

@ -126,14 +126,10 @@ def CheckAuthorizedAuthor(input_api, output_api, bot_allowlist=None):
authors_path = input_api.os_path.join(
input_api.PresubmitLocalPath(), 'AUTHORS')
author_re = input_api.re.compile(r'[^#]+\s+\<(.+?)\>\s*$')
valid_authors = []
with open(authors_path, 'rb') as fp:
for line in fp:
m = author_re.match(line.decode('utf8'))
if m:
valid_authors.append(m.group(1)).lower()
valid_authors = (
input_api.re.match(r'[^#]+\s+\<(.+?)\>\s*$', line)
for line in open(authors_path))
valid_authors = [item.group(1).lower() for item in valid_authors if item]
if not any(input_api.fnmatch.fnmatch(author.lower(), valid)
for valid in valid_authors):
input_api.logging.info('Valid authors are %s', ', '.join(valid_authors))

Loading…
Cancel
Save