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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 A list of directories. | 56 A list of directories. |
57 """ | 57 """ |
58 | 58 |
59 result = [] | 59 result = [] |
60 for directory in _FindThirdPartyDirs(): | 60 for directory in _FindThirdPartyDirs(): |
61 if directory in known_issues.KNOWN_ISSUES: | 61 if directory in known_issues.KNOWN_ISSUES: |
62 result.append(directory) | 62 result.append(directory) |
63 continue | 63 continue |
64 try: | 64 try: |
65 metadata = licenses.ParseDir(directory, REPOSITORY_ROOT, | 65 metadata = licenses.ParseDir(directory, REPOSITORY_ROOT, |
66 require_license_file=False) | 66 require_license_file=False, |
| 67 optional_keys=['License Android Compatible']) |
67 except licenses.LicenseError as e: | 68 except licenses.LicenseError as e: |
68 print 'Got LicenseError while scanning ' + directory | 69 print 'Got LicenseError while scanning ' + directory |
69 raise | 70 raise |
70 if metadata.get('License Android Compatible', 'no').upper() == 'YES': | 71 if metadata.get('License Android Compatible', 'no').upper() == 'YES': |
71 continue | 72 continue |
72 license = re.split(' [Ll]icenses?$', metadata['License'])[0] | 73 license = re.split(' [Ll]icenses?$', metadata['License'])[0] |
73 if not third_party.LicenseIsCompatibleWithAndroid(InputApi(), license): | 74 if not third_party.LicenseIsCompatibleWithAndroid(InputApi(), license): |
74 result.append(directory) | 75 result.append(directory) |
75 return result | 76 return result |
76 | 77 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 files = sys.stdin.read().splitlines() | 363 files = sys.stdin.read().splitlines() |
363 for f, c in \ | 364 for f, c in \ |
364 zip(files, copyright_scanner.FindCopyrights(InputApi(), '.', files)): | 365 zip(files, copyright_scanner.FindCopyrights(InputApi(), '.', files)): |
365 print f, '\t', ' / '.join(sorted(c)) | 366 print f, '\t', ' / '.join(sorted(c)) |
366 return ScanResult.Ok | 367 return ScanResult.Ok |
367 parser.print_help() | 368 parser.print_help() |
368 return ScanResult.Errors | 369 return ScanResult.Errors |
369 | 370 |
370 if __name__ == '__main__': | 371 if __name__ == '__main__': |
371 sys.exit(main()) | 372 sys.exit(main()) |
OLD | NEW |