From 9bb9cb8156148dc3c23c9c2b8cd1fb07014a698a Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Mon, 13 Jun 2011 20:43:01 +0000 Subject: [PATCH] Allow wildcard for corporate CLA. Add nvidia to AUTHORS. BUG=none TEST=none Review URL: http://codereview.chromium.org/7003151 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88891 0039d316-1c4b-4281-b951-d872f2087c98 --- AUTHORS | 19 ++++++++++++++----- PRESUBMIT.py | 13 ++++++++++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index 929c47d30c1ef8..90df1342892ba1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,7 +1,15 @@ -# Names should be added to this file like so: -# Name or Organization +# Names should be added to this file with this pattern: +# +# For individuals: +# Name +# +# For organizations: +# Organization +# +# See python fnmatch module documentation for more information. -Google Inc. +The Chromium Authors <*@chromium.org> +Google Inc. <*@google.com> Seo Sanghyeon Alex Scheele Andrew Brampton @@ -71,7 +79,7 @@ Chamal De Silva Jay Soffian Brian G. Merrell Matthew Willis -Novell Inc. +Novell Inc. <*@novell.com> Ryan Sleevi Satoshi Matsuzaki Benjamin Jemlich @@ -80,7 +88,7 @@ Jared Wein Mingmin Xie Michael Gilbert Giuseppe Iuculano -litl LLC +litl LLC <*@litl.com> James Willcox Shreyas VA Steven Pennington @@ -104,3 +112,4 @@ David Futcher Ramkumar Gokarnesan Matt Arpidone ruben +NVIDIA Corporation <*@nvidia.com> diff --git a/PRESUBMIT.py b/PRESUBMIT.py index eafb77a1d89ff5..6fface8db19a58 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'