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
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index eafb77a1..6fface8 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -96,9 +96,12 @@
   """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 @@
       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'