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

Side by Side Diff: tools/licenses.py

Issue 1530040: Down to only 4 dirs that don't pass the license checker. (Closed)
Patch Set: missing files Created 10 years, 8 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ 6 """
7 Utilities for checking and processing licensing information in third_party 7 Utilities for checking and processing licensing information in third_party
8 directories. 8 directories.
9 """ 9 """
10 10
11 import os 11 import os
12 12
13 # Paths from the root of the tree to directories to skip. 13 # Paths from the root of the tree to directories to skip.
14 PRUNE_PATHS = set([ 14 PRUNE_PATHS = set([
15 # Assume for now that breakpad has their licensing in order.
16 "breakpad",
17
15 # This is just a tiny vsprops file, presumably written by the googleurl 18 # This is just a tiny vsprops file, presumably written by the googleurl
16 # authors. Not third-party code. 19 # authors. Not third-party code.
17 "googleurl/third_party/icu", 20 "googleurl/third_party/icu",
18 21
22 # Assume for now that native client has their licensing in order.
23 "native_client",
24
19 # We don't bundle o3d samples into our resulting binaries. 25 # We don't bundle o3d samples into our resulting binaries.
20 "o3d/samples", 26 "o3d/samples",
21 27
28 # Not in the public Chromium tree.
29 "third_party/adobe",
30
22 # Written as part of Chromium. 31 # Written as part of Chromium.
23 "third_party/fuzzymatch", 32 "third_party/fuzzymatch",
24 33
25 # Two directories that are the same as those in base/third_party. 34 # Two directories that are the same as those in base/third_party.
26 "v8/src/third_party/dtoa", 35 "v8/src/third_party/dtoa",
27 "v8/src/third_party/valgrind", 36 "v8/src/third_party/valgrind",
28 ]) 37 ])
29 38
30 # Directories we don't scan through. 39 # Directories we don't scan through.
31 PRUNE_DIRS = ('.svn', '.git', # VCS metadata 40 PRUNE_DIRS = ('.svn', '.git', # VCS metadata
32 'out', 'Debug', 'Release', # build files 41 'out', 'Debug', 'Release', # build files
33 'layout_tests') # lots of subdirs 42 'layout_tests') # lots of subdirs
34 43
35 # Directories where we check out directly from upstream, and therefore 44 # Directories where we check out directly from upstream, and therefore
36 # can't provide a README.chromium. Please prefer a README.chromium 45 # can't provide a README.chromium. Please prefer a README.chromium
37 # wherever possible. 46 # wherever possible.
38 SPECIAL_CASES = { 47 SPECIAL_CASES = {
39 'third_party/ots': { 48 'third_party/ots': {
40 "Name": "OTS (OpenType Sanitizer)", 49 "Name": "OTS (OpenType Sanitizer)",
41 "URL": "http://code.google.com/p/ots/", 50 "URL": "http://code.google.com/p/ots/",
42 }, 51 },
43 'third_party/pywebsocket': { 52 'third_party/pywebsocket': {
44 "Name": "pywebsocket", 53 "Name": "pywebsocket",
45 "URL": "http://code.google.com/p/pywebsocket/", 54 "URL": "http://code.google.com/p/pywebsocket/",
46 }, 55 },
56 'third_party/WebKit': {
57 "Name": "WebKit",
58 "URL": "http://webkit.org/",
59 },
47 } 60 }
48 61
49 class LicenseError(Exception): 62 class LicenseError(Exception):
50 """We raise this exception when a directory's licensing info isn't 63 """We raise this exception when a directory's licensing info isn't
51 fully filled out.""" 64 fully filled out."""
52 pass 65 pass
53 66
54 67
55 def ParseDir(path): 68 def ParseDir(path):
56 """Examine a third_party/foo component and extract its metadata.""" 69 """Examine a third_party/foo component and extract its metadata."""
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 120
108 def ScanThirdPartyDirs(third_party_dirs): 121 def ScanThirdPartyDirs(third_party_dirs):
109 """Scan a list of directories and report on any problems we find.""" 122 """Scan a list of directories and report on any problems we find."""
110 errors = [] 123 errors = []
111 for path in sorted(third_party_dirs): 124 for path in sorted(third_party_dirs):
112 try: 125 try:
113 metadata = ParseDir(path) 126 metadata = ParseDir(path)
114 except LicenseError, e: 127 except LicenseError, e:
115 errors.append((path, e.args[0])) 128 errors.append((path, e.args[0]))
116 continue 129 continue
117 print path, "OK:", metadata["License File"]
118
119 print
120 130
121 for path, error in sorted(errors): 131 for path, error in sorted(errors):
122 print path + ": " + error 132 print path + ": " + error
123 133
124 134
125 def FindThirdPartyDirs(): 135 def FindThirdPartyDirs():
126 """Find all third_party directories underneath the current directory.""" 136 """Find all third_party directories underneath the current directory."""
127 third_party_dirs = [] 137 third_party_dirs = []
128 for path, dirs, files in os.walk('.'): 138 for path, dirs, files in os.walk('.'):
129 path = path[len('./'):] # Pretty up the path. 139 path = path[len('./'):] # Pretty up the path.
(...skipping 19 matching lines...) Expand all
149 # Don't recurse into any subdirs from here. 159 # Don't recurse into any subdirs from here.
150 dirs[:] = [] 160 dirs[:] = []
151 continue 161 continue
152 162
153 return third_party_dirs 163 return third_party_dirs
154 164
155 165
156 if __name__ == '__main__': 166 if __name__ == '__main__':
157 third_party_dirs = FindThirdPartyDirs() 167 third_party_dirs = FindThirdPartyDirs()
158 ScanThirdPartyDirs(third_party_dirs) 168 ScanThirdPartyDirs(third_party_dirs)
OLDNEW
« third_party/modp_b64/LICENSE ('K') | « third_party/tcmalloc/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698