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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 # Flatten out the result | 90 # Flatten out the result |
91 offending_files = \ | 91 offending_files = \ |
92 [item for sublist in offending_files_chunks for item in sublist] | 92 [item for sublist in offending_files_chunks for item in sublist] |
93 | 93 |
94 (unknown, missing, stale) = copyright_scanner.AnalyzeScanResults( | 94 (unknown, missing, stale) = copyright_scanner.AnalyzeScanResults( |
95 input_api, whitelisted_files, offending_files) | 95 input_api, whitelisted_files, offending_files) |
96 | 96 |
97 if unknown: | 97 if unknown: |
98 print 'The following files contain a third-party license but are not in ' \ | 98 print 'The following files contain a third-party license but are not in ' \ |
99 'a listed third-party directory and are not whitelisted. You must ' \ | 99 'a listed third-party directory and are not whitelisted. You must ' \ |
100 'add the following files to the whitelist.\n%s' % \ | 100 'add the following files to the whitelist.\n' \ |
| 101 '(Note that if the code you are adding does not actually contain ' \ |
| 102 'any third-party code, it may contain the word "copyright", which ' \ |
| 103 'should be masked out, e.g. by writing it as "copy-right")\n%s' % \ |
101 '\n'.join(sorted(unknown)) | 104 '\n'.join(sorted(unknown)) |
102 if missing: | 105 if missing: |
103 print 'The following files are whitelisted, but do not exist.\n%s' % \ | 106 print 'The following files are whitelisted, but do not exist.\n%s' % \ |
104 '\n'.join(sorted(missing)) | 107 '\n'.join(sorted(missing)) |
105 if stale: | 108 if stale: |
106 print 'The following files are whitelisted unnecessarily. You must ' \ | 109 print 'The following files are whitelisted unnecessarily. You must ' \ |
107 'remove the following files from the whitelist.\n%s' % \ | 110 'remove the following files from the whitelist.\n%s' % \ |
108 '\n'.join(sorted(stale)) | 111 '\n'.join(sorted(stale)) |
109 | 112 |
110 if unknown: | 113 if unknown: |
111 code = ScanResult.Errors | 114 code = ScanResult.Errors |
112 elif stale or missing: | 115 elif stale or missing: |
113 code = ScanResult.Warnings | 116 code = ScanResult.Warnings |
114 else: | 117 else: |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 files = sys.stdin.read().splitlines() | 293 files = sys.stdin.read().splitlines() |
291 for f, c in \ | 294 for f, c in \ |
292 zip(files, copyright_scanner.FindCopyrights(InputApi(), '.', files)): | 295 zip(files, copyright_scanner.FindCopyrights(InputApi(), '.', files)): |
293 print f, '\t', ' / '.join(sorted(c)) | 296 print f, '\t', ' / '.join(sorted(c)) |
294 return ScanResult.Ok | 297 return ScanResult.Ok |
295 parser.print_help() | 298 parser.print_help() |
296 return ScanResult.Errors | 299 return ScanResult.Errors |
297 | 300 |
298 if __name__ == '__main__': | 301 if __name__ == '__main__': |
299 sys.exit(main()) | 302 sys.exit(main()) |
OLD | NEW |