Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Unified Diff: tools/checklicenses/checklicenses.py

Issue 1054753002: Switch jsoncpp to be single DEPS entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/checklicenses/checklicenses.py
diff --git a/tools/checklicenses/checklicenses.py b/tools/checklicenses/checklicenses.py
index 22e13ee49f1480a9b889eb2714bf90484acaef9e..dfd980957ab68a4c6c208246eaa768be0274921a 100755
--- a/tools/checklicenses/checklicenses.py
+++ b/tools/checklicenses/checklicenses.py
@@ -6,6 +6,7 @@
"""Makes sure that all files contain proper licensing information."""
+import fnmatch
Paweł Hajdan Jr. 2015/04/02 09:58:24 PLease do not add fnmatch support to checklicenses
import json
import optparse
import os.path
@@ -421,6 +422,13 @@ PATH_SPECIFIC_WHITELISTED_LICENSES = {
}
+FNMATCH_WHITELISTED_LICENSES = {
+ 'third_party/jsoncpp/source/*.py': [ # http://crbug.com/472816
+ 'UNKNOWN',
+ ],
+}
+
+
def check_licenses(options, args):
# Figure out which directory we have to check.
if len(args) == 0:
@@ -462,6 +470,7 @@ def check_licenses(options, args):
return 1
used_suppressions = set()
+ used_fnmatch_suppressions = set()
errors = []
for line in stdout.splitlines():
@@ -492,6 +501,16 @@ def check_licenses(options, args):
used_suppressions.update(set(matched_prefixes))
continue
+ matched_pattern = None
+ for pattern in FNMATCH_WHITELISTED_LICENSES:
+ if fnmatch.fnmatch(filename, pattern):
+ matched_pattern = pattern
+ break
+
+ if matched_pattern:
+ used_fnmatch_suppressions.add(matched_pattern)
+ continue
+
errors.append({'filename': filename, 'license': license})
if options.json:
@@ -526,6 +545,13 @@ def check_licenses(options, args):
print "\nNOTE: unused suppressions detected:\n"
print '\n'.join(unused_suppressions)
+ unused_fnmatch_suppressions = set(
+ FNMATCH_WHITELISTED_LICENSES.iterkeys()).difference(
+ used_fnmatch_suppressions)
+ if unused_fnmatch_suppressions:
+ print "\nNOTE: unused fnmatch suppressions detected:\n"
+ print '\n'.join(unused_fnmatch_suppressions)
+
return 0
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698