summaryrefslogtreecommitdiffstats
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r--PRESUBMIT.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index eafb77a..6fface8 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -96,9 +96,12 @@ def _CheckAuthorizedAuthor(input_api, output_api):
"""For non-googler/chromites committers, verify the author's email address is
in AUTHORS.
"""
+ # TODO(maruel): Add it to input_api?
+ import fnmatch
+
author = input_api.change.author_email
- if (author is None or author.endswith('@chromium.org') or
- author.endswith('@google.com')):
+ if not author:
+ input_api.logging.info('No author, skipping AUTHOR check')
return []
authors_path = input_api.os_path.join(
input_api.PresubmitLocalPath(), 'AUTHORS')
@@ -106,7 +109,11 @@ def _CheckAuthorizedAuthor(input_api, output_api):
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 author.lower() in valid_authors:
+ if input_api.verbose:
+ print 'Valid authors are %s' % ', '.join(valid_authors)
+ if not any(
+ True for valid in valid_authors
+ if fnmatch.fnmatch(author.lower(), valid)):
return [output_api.PresubmitPromptWarning(
('%s is not in AUTHORS file. If you are a new contributor, please visit'
'\n'