OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Utility for checking and processing licensing information in third_party | 6 """Utility for checking and processing licensing information in third_party |
7 directories. | 7 directories. |
8 | 8 |
9 Usage: licenses.py <command> | 9 Usage: licenses.py <command> |
10 | 10 |
11 Commands: | 11 Commands: |
12 scan scan third_party directories, verifying that we have licensing info | 12 scan scan third_party directories, verifying that we have licensing info |
13 credits generate about:credits on stdout | 13 credits generate about:credits on stdout |
14 | 14 |
15 (You can also import this as a module.) | 15 (You can also import this as a module.) |
16 """ | 16 """ |
17 | 17 |
18 import cgi | 18 import cgi |
19 import os | 19 import os |
20 import sys | 20 import sys |
21 | 21 |
22 # Paths from the root of the tree to directories to skip. | 22 # Paths from the root of the tree to directories to skip. |
23 PRUNE_PATHS = set([ | 23 PRUNE_PATHS = set([ |
24 # Same module occurs in both the top-level third_party and others. | |
25 os.path.join('base','third_party','icu'), | |
26 | |
27 # Assume for now that breakpad has their licensing in order. | |
28 os.path.join('breakpad'), | |
29 | |
30 # Assume for now that native client has their licensing in order. | |
31 os.path.join('native_client'), | |
32 | |
33 # Same module occurs in chrome/ and in net/, so skip one of them. | |
34 os.path.join('net','third_party','mozilla_security_manager'), | |
35 | |
36 # Same module occurs in base/, net/, and src/ so skip all but one of them. | 24 # Same module occurs in base/, net/, and src/ so skip all but one of them. |
37 os.path.join('third_party','nss'), | 25 os.path.join('third_party','nss'), |
38 os.path.join('net','third_party','nss'), | |
39 | 26 |
40 # Placeholder directory only, not third-party code. | 27 # Placeholder directory only, not third-party code. |
41 os.path.join('third_party','adobe'), | 28 os.path.join('third_party','adobe'), |
42 | 29 |
43 # Same license as Chromium. | |
44 os.path.join('third_party','lss'), | |
45 | |
46 # Only binaries, used during development. | 30 # Only binaries, used during development. |
47 os.path.join('third_party','valgrind'), | 31 os.path.join('third_party','valgrind'), |
48 | 32 |
49 # Directories that are the same as those in base/third_party. | |
50 os.path.join('v8','src','third_party','valgrind'), | |
51 | |
52 # Used for development and test, not in the shipping product. | 33 # Used for development and test, not in the shipping product. |
53 os.path.join('third_party','bidichecker'), | 34 os.path.join('third_party','bidichecker'), |
54 os.path.join('third_party','cygwin'), | 35 os.path.join('third_party','cygwin'), |
55 os.path.join('third_party','gold'), | 36 os.path.join('third_party','gold'), |
56 os.path.join('third_party','lighttpd'), | 37 os.path.join('third_party','lighttpd'), |
57 os.path.join('third_party','mingw-w64'), | 38 os.path.join('third_party','mingw-w64'), |
58 os.path.join('third_party','pefile'), | 39 os.path.join('third_party','pefile'), |
59 os.path.join('third_party','python_26'), | 40 os.path.join('third_party','python_26'), |
60 | 41 |
61 # Stuff pulled in from chrome-internal for official builds/tools. | 42 # Stuff pulled in from chrome-internal for official builds/tools. |
62 os.path.join('third_party', 'clear_cache'), | 43 os.path.join('third_party', 'clear_cache'), |
63 os.path.join('third_party', 'gnu'), | 44 os.path.join('third_party', 'gnu'), |
64 os.path.join('third_party', 'googlemac'), | 45 os.path.join('third_party', 'googlemac'), |
65 os.path.join('third_party', 'pcre'), | 46 os.path.join('third_party', 'pcre'), |
66 os.path.join('third_party', 'psutils'), | 47 os.path.join('third_party', 'psutils'), |
67 os.path.join('third_party', 'sawbuck'), | 48 os.path.join('third_party', 'sawbuck'), |
68 | 49 |
69 # Redistribution does not require attribution in documentation. | 50 # Redistribution does not require attribution in documentation. |
70 os.path.join('third_party','directxsdk'), | 51 os.path.join('third_party','directxsdk'), |
71 os.path.join('third_party','platformsdk_win2008_6_1'), | 52 os.path.join('third_party','platformsdk_win2008_6_1'), |
72 os.path.join('third_party','platformsdk_win7'), | 53 os.path.join('third_party','platformsdk_win7'), |
73 | |
74 # Harfbuzz-ng is not currently shipping in any product: | |
75 os.path.join('third_party','harfbuzz-ng'), | |
76 ]) | 54 ]) |
77 | 55 |
78 # Directories we don't scan through. | 56 # Directories we don't scan through. |
79 PRUNE_DIRS = ('.svn', '.git', # VCS metadata | 57 PRUNE_DIRS = ('.svn', '.git', # VCS metadata |
80 'out', 'Debug', 'Release', # build files | 58 'out', 'Debug', 'Release', # build files |
81 'layout_tests') # lots of subdirs | 59 'layout_tests') # lots of subdirs |
82 | 60 |
83 ADDITIONAL_PATHS = ( | 61 ADDITIONAL_PATHS = ( |
| 62 os.path.join('breakpad'), |
| 63 os.path.join('chrome', 'common', 'extensions', 'docs', 'examples'), |
| 64 os.path.join('chrome', 'test', 'chromeos', 'autotest'), |
84 os.path.join('googleurl'), | 65 os.path.join('googleurl'), |
| 66 os.path.join('native_client'), |
85 os.path.join('native_client_sdk'), | 67 os.path.join('native_client_sdk'), |
| 68 os.path.join('net', 'tools', 'spdyshark'), |
86 os.path.join('ppapi'), | 69 os.path.join('ppapi'), |
| 70 os.path.join('sandbox', 'linux', 'seccomp-legacy'), |
| 71 os.path.join('sdch', 'open-vcdiff'), |
| 72 os.path.join('testing', 'gmock'), |
| 73 os.path.join('testing', 'gtest'), |
87 # The directory with the word list for Chinese and Japanese segmentation | 74 # The directory with the word list for Chinese and Japanese segmentation |
88 # with different license terms than ICU. | 75 # with different license terms than ICU. |
89 os.path.join('third_party','icu','source','data','brkitr'), | 76 os.path.join('third_party','icu','source','data','brkitr'), |
| 77 os.path.join('tools', 'grit'), |
| 78 os.path.join('tools', 'gyp'), |
| 79 os.path.join('tools', 'page_cycler', 'acid3'), |
| 80 os.path.join('v8'), |
90 # Fake directory so we can include the strongtalk license. | 81 # Fake directory so we can include the strongtalk license. |
91 os.path.join('v8', 'strongtalk'), | 82 os.path.join('v8', 'strongtalk'), |
92 ) | 83 ) |
93 | 84 |
94 | 85 |
95 # Directories where we check out directly from upstream, and therefore | 86 # Directories where we check out directly from upstream, and therefore |
96 # can't provide a README.chromium. Please prefer a README.chromium | 87 # can't provide a README.chromium. Please prefer a README.chromium |
97 # wherever possible. | 88 # wherever possible. |
98 SPECIAL_CASES = { | 89 SPECIAL_CASES = { |
99 'googleurl': { | 90 os.path.join('googleurl'): { |
100 "Name": "google-url", | 91 "Name": "google-url", |
101 "URL": "http://code.google.com/p/google-url/", | 92 "URL": "http://code.google.com/p/google-url/", |
102 "License": "BSD and MPL 1.1/GPL 2.0/LGPL 2.1", | 93 "License": "BSD and MPL 1.1/GPL 2.0/LGPL 2.1", |
103 "License File": "LICENSE.txt", | 94 "License File": "LICENSE.txt", |
104 }, | 95 }, |
| 96 os.path.join('native_client'): { |
| 97 "Name": "native client", |
| 98 "URL": "http://code.google.com/p/nativeclient", |
| 99 "License": "BSD", |
| 100 }, |
| 101 os.path.join('sandbox', 'linux', 'seccomp-legacy'): { |
| 102 "Name": "seccompsandbox", |
| 103 "URL": "http://code.google.com/p/seccompsandbox", |
| 104 "License": "BSD", |
| 105 }, |
| 106 os.path.join('sdch', 'open-vcdiff'): { |
| 107 "Name": "open-vcdiff", |
| 108 "URL": "http://code.google.com/p/open-vcdiff", |
| 109 "License": "Apache 2.0, MIT, GPL v2 and custom licenses", |
| 110 }, |
| 111 os.path.join('testing', 'gmock'): { |
| 112 "Name": "gmock", |
| 113 "URL": "http://code.google.com/p/googlemock", |
| 114 "License": "BSD", |
| 115 }, |
| 116 os.path.join('testing', 'gtest'): { |
| 117 "Name": "gtest", |
| 118 "URL": "http://code.google.com/p/googletest", |
| 119 "License": "BSD", |
| 120 }, |
105 os.path.join('third_party', 'angle'): { | 121 os.path.join('third_party', 'angle'): { |
106 "Name": "Almost Native Graphics Layer Engine", | 122 "Name": "Almost Native Graphics Layer Engine", |
107 "URL": "http://code.google.com/p/angleproject/", | 123 "URL": "http://code.google.com/p/angleproject/", |
108 "License": "BSD", | 124 "License": "BSD", |
109 }, | 125 }, |
110 os.path.join('third_party', 'cros_system_api'): { | 126 os.path.join('third_party', 'cros_system_api'): { |
111 "Name": "Chromium OS system API", | 127 "Name": "Chromium OS system API", |
112 "URL": "http://www.chromium.org/chromium-os", | 128 "URL": "http://www.chromium.org/chromium-os", |
113 "License": "BSD", | 129 "License": "BSD", |
114 # Absolute path here is resolved as relative to the source root. | 130 # Absolute path here is resolved as relative to the source root. |
115 "License File": "/LICENSE.chromium_os", | 131 "License File": "/LICENSE.chromium_os", |
116 }, | 132 }, |
117 os.path.join('third_party', 'GTM'): { | 133 os.path.join('third_party', 'GTM'): { |
118 "Name": "Google Toolbox for Mac", | 134 "Name": "Google Toolbox for Mac", |
119 "URL": "http://code.google.com/p/google-toolbox-for-mac/", | 135 "URL": "http://code.google.com/p/google-toolbox-for-mac/", |
120 "License": "Apache 2.0", | 136 "License": "Apache 2.0", |
121 "License File": "COPYING", | 137 "License File": "COPYING", |
122 }, | 138 }, |
123 os.path.join('third_party', 'lss'): { | 139 os.path.join('third_party', 'lss'): { |
124 "Name": "linux-syscall-support", | 140 "Name": "linux-syscall-support", |
125 "URL": "http://code.google.com/p/lss/", | 141 "URL": "http://code.google.com/p/lss/", |
| 142 "License": "BSD", |
| 143 "License File": "/LICENSE", |
126 }, | 144 }, |
127 os.path.join('third_party', 'ots'): { | 145 os.path.join('third_party', 'ots'): { |
128 "Name": "OTS (OpenType Sanitizer)", | 146 "Name": "OTS (OpenType Sanitizer)", |
129 "URL": "http://code.google.com/p/ots/", | 147 "URL": "http://code.google.com/p/ots/", |
130 "License": "BSD", | 148 "License": "BSD", |
131 }, | 149 }, |
132 os.path.join('third_party', 'pdfsqueeze'): { | 150 os.path.join('third_party', 'pdfsqueeze'): { |
133 "Name": "pdfsqueeze", | 151 "Name": "pdfsqueeze", |
134 "URL": "http://code.google.com/p/pdfsqueeze/", | 152 "URL": "http://code.google.com/p/pdfsqueeze/", |
135 "License": "Apache 2.0", | 153 "License": "Apache 2.0", |
(...skipping 23 matching lines...) Expand all Loading... |
159 "URL": "http://webkit.org/", | 177 "URL": "http://webkit.org/", |
160 "License": "BSD and GPL v2", | 178 "License": "BSD and GPL v2", |
161 # Absolute path here is resolved as relative to the source root. | 179 # Absolute path here is resolved as relative to the source root. |
162 "License File": "/webkit/LICENSE", | 180 "License File": "/webkit/LICENSE", |
163 }, | 181 }, |
164 os.path.join('third_party', 'webpagereplay'): { | 182 os.path.join('third_party', 'webpagereplay'): { |
165 "Name": "webpagereplay", | 183 "Name": "webpagereplay", |
166 "URL": "http://code.google.com/p/web-page-replay", | 184 "URL": "http://code.google.com/p/web-page-replay", |
167 "License": "Apache 2.0", | 185 "License": "Apache 2.0", |
168 }, | 186 }, |
| 187 os.path.join('tools', 'grit'): { |
| 188 "Name": "grit", |
| 189 "URL": "http://code.google.com/p/grit-i18n", |
| 190 "License": "BSD", |
| 191 }, |
| 192 os.path.join('tools', 'gyp'): { |
| 193 "Name": "gyp", |
| 194 "URL": "http://code.google.com/p/gyp", |
| 195 "License": "BSD", |
| 196 }, |
| 197 os.path.join('v8'): { |
| 198 "Name": "gyp", |
| 199 "URL": "http://code.google.com/p/v8", |
| 200 "License": "BSD", |
| 201 }, |
169 os.path.join('v8', 'strongtalk'): { | 202 os.path.join('v8', 'strongtalk'): { |
170 "Name": "Strongtalk", | 203 "Name": "Strongtalk", |
171 "URL": "http://www.strongtalk.org/", | 204 "URL": "http://www.strongtalk.org/", |
172 "License": "BSD", | 205 "License": "BSD", |
173 # Absolute path here is resolved as relative to the source root. | 206 # Absolute path here is resolved as relative to the source root. |
174 "License File": "/v8/LICENSE.strongtalk", | 207 "License File": "/v8/LICENSE.strongtalk", |
175 }, | 208 }, |
176 } | 209 } |
177 | 210 |
178 class LicenseError(Exception): | 211 class LicenseError(Exception): |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 elif command == 'credits': | 412 elif command == 'credits': |
380 if not GenerateCredits(): | 413 if not GenerateCredits(): |
381 return 1 | 414 return 1 |
382 else: | 415 else: |
383 print __doc__ | 416 print __doc__ |
384 return 1 | 417 return 1 |
385 | 418 |
386 | 419 |
387 if __name__ == '__main__': | 420 if __name__ == '__main__': |
388 sys.exit(main()) | 421 sys.exit(main()) |
OLD | NEW |