OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Checks third-party licenses for the purposes of the Android WebView build. | 6 """Checks third-party licenses for the purposes of the Android WebView build. |
7 | 7 |
8 The Android tree includes a snapshot of Chromium in order to power the system | 8 The Android tree includes a snapshot of Chromium in order to power the system |
9 WebView. This tool checks that all code uses open-source licenses compatible | 9 WebView. This tool checks that all code uses open-source licenses compatible |
10 with Android, and that we meet the requirements of those licenses. It can also | 10 with Android, and that we meet the requirements of those licenses. It can also |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 def _FindThirdPartyDirs(): | 198 def _FindThirdPartyDirs(): |
199 """Gets the list of third-party directories. | 199 """Gets the list of third-party directories. |
200 Returns: | 200 Returns: |
201 The list of third-party directories. | 201 The list of third-party directories. |
202 """ | 202 """ |
203 | 203 |
204 # Please don't add here paths that have problems with license files, | 204 # Please don't add here paths that have problems with license files, |
205 # as they will end up included in Android WebView snapshot. | 205 # as they will end up included in Android WebView snapshot. |
206 # Instead, add them into known_issues.py. | 206 # Instead, add them into known_issues.py. |
207 prune_paths = [ | 207 prune_paths = set([ |
208 # Temporary until we figure out how not to check out quickoffice on the | |
209 # Android license check bot. Tracked in crbug.com/350472. | |
210 os.path.join('chrome', 'browser', 'resources', 'chromeos', 'quickoffice'), | |
211 # Placeholder directory, no third-party code. | |
212 os.path.join('third_party', 'adobe'), | |
213 # Apache 2.0 license. See | 208 # Apache 2.0 license. See |
214 # https://code.google.com/p/chromium/issues/detail?id=140478. | 209 # https://code.google.com/p/chromium/issues/detail?id=140478. |
215 os.path.join('third_party', 'bidichecker'), | 210 os.path.join('third_party', 'bidichecker'), |
216 # Isn't checked out on clients | |
217 os.path.join('third_party', 'gles2_conform'), | |
218 # The llvm-build doesn't exist for non-clang builder | |
219 os.path.join('third_party', 'llvm-build'), | |
220 # Binaries doesn't apply to android | |
221 os.path.join('third_party', 'widevine'), | |
222 # third_party directories in this tree aren't actually third party, but | |
223 # provide a way to shadow experimental buildfiles into those directories. | |
224 os.path.join('build', 'secondary'), | |
225 # Not shipped, Chromium code | |
226 os.path.join('tools', 'swarming_client'), | |
227 # Not shipped, only relates to Chrome for Android, but not to WebView | 211 # Not shipped, only relates to Chrome for Android, but not to WebView |
228 os.path.join('clank'), | 212 os.path.join('clank'), |
229 # Bots only, is not a part of the build | 213 ]) |
230 os.path.join('isolate_deps_dir'), | 214 third_party_dirs = licenses.FindThirdPartyDirs( |
231 ] | 215 prune_paths | licenses.PRUNE_PATHS, REPOSITORY_ROOT) |
232 third_party_dirs = licenses.FindThirdPartyDirs(prune_paths, REPOSITORY_ROOT) | |
233 return licenses.FilterDirsWithFiles(third_party_dirs, REPOSITORY_ROOT) | 216 return licenses.FilterDirsWithFiles(third_party_dirs, REPOSITORY_ROOT) |
234 | 217 |
235 | 218 |
236 def _Scan(): | 219 def _Scan(): |
237 """Checks that license meta-data is present for all third-party code and | 220 """Checks that license meta-data is present for all third-party code and |
238 that all non third-party code doesn't contain external copyrighted code. | 221 that all non third-party code doesn't contain external copyrighted code. |
239 Returns: | 222 Returns: |
240 ScanResult.Ok if everything is in order; | 223 ScanResult.Ok if everything is in order; |
241 ScanResult.Warnings if there are non-fatal problems (e.g. stale whitelist | 224 ScanResult.Warnings if there are non-fatal problems (e.g. stale whitelist |
242 entries) | 225 entries) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 files = sys.stdin.read().splitlines() | 393 files = sys.stdin.read().splitlines() |
411 for f, c in \ | 394 for f, c in \ |
412 zip(files, copyright_scanner.FindCopyrights(InputApi(), '.', files)): | 395 zip(files, copyright_scanner.FindCopyrights(InputApi(), '.', files)): |
413 print f, '\t', ' / '.join(sorted(c)) | 396 print f, '\t', ' / '.join(sorted(c)) |
414 return ScanResult.Ok | 397 return ScanResult.Ok |
415 parser.print_help() | 398 parser.print_help() |
416 return ScanResult.Errors | 399 return ScanResult.Errors |
417 | 400 |
418 if __name__ == '__main__': | 401 if __name__ == '__main__': |
419 sys.exit(main()) | 402 sys.exit(main()) |
OLD | NEW |