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

Side by Side Diff: android_webview/tools/webview_licenses.py

Issue 11421199: Update webview license tool to match licenses.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/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 """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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 'Public Domain', 51 'Public Domain',
52 'SGI Free Software License B', 52 'SGI Free Software License B',
53 'X11', 53 'X11',
54 ] 54 ]
55 regex = '^(%s)$' % '|'.join(whitelist) 55 regex = '^(%s)$' % '|'.join(whitelist)
56 result = [] 56 result = []
57 for directory in _FindThirdPartyDirs(): 57 for directory in _FindThirdPartyDirs():
58 if directory in known_issues.KNOWN_ISSUES: 58 if directory in known_issues.KNOWN_ISSUES:
59 result.append(directory) 59 result.append(directory)
60 continue 60 continue
61 metadata = licenses.ParseDir(directory, REPOSITORY_ROOT, 61 try:
62 require_license_file=False) 62 metadata = licenses.ParseDir(directory, REPOSITORY_ROOT,
63 require_license_file=False)
64 except licenses.LicenseError as e:
65 print 'Got LicenseError while scanning ' + directory
66 raise
63 if metadata.get('License Android Compatible', 'no') == 'yes': 67 if metadata.get('License Android Compatible', 'no') == 'yes':
64 continue 68 continue
65 license = re.split(' [Ll]icenses?$', metadata['License'])[0] 69 license = re.split(' [Ll]icenses?$', metadata['License'])[0]
66 tokens = [x.strip() for x in re.split(' and |,', license) if len(x) > 0] 70 tokens = [x.strip() for x in re.split(' and |,', license) if len(x) > 0]
67 for token in tokens: 71 for token in tokens:
68 if not re.match(regex, token, re.IGNORECASE): 72 if not re.match(regex, token, re.IGNORECASE):
69 result.append(directory) 73 result.append(directory)
70 break 74 break
71 return result 75 return result
72 76
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 # Apache 2.0 license. See 186 # Apache 2.0 license. See
183 # https://code.google.com/p/chromium/issues/detail?id=140478. 187 # https://code.google.com/p/chromium/issues/detail?id=140478.
184 os.path.join('third_party', 'bidichecker'), 188 os.path.join('third_party', 'bidichecker'),
185 # Isn't checked out on clients 189 # Isn't checked out on clients
186 os.path.join('third_party', 'gles2_conform'), 190 os.path.join('third_party', 'gles2_conform'),
187 # The llvm-build doesn't exist for non-clang builder 191 # The llvm-build doesn't exist for non-clang builder
188 os.path.join('third_party', 'llvm-build'), 192 os.path.join('third_party', 'llvm-build'),
189 # Binaries doesn't apply to android 193 # Binaries doesn't apply to android
190 os.path.join('third_party', 'widevine'), 194 os.path.join('third_party', 'widevine'),
191 ] 195 ]
192 return licenses.FindThirdPartyDirs(prune_paths, REPOSITORY_ROOT) 196 third_party_dirs = licenses.FindThirdPartyDirs(prune_paths, REPOSITORY_ROOT)
197 return licenses.FilterDirsWithFiles(third_party_dirs, REPOSITORY_ROOT)
193 198
194 199
195 def _Scan(): 200 def _Scan():
196 """Checks that license meta-data is present for all third-party code. 201 """Checks that license meta-data is present for all third-party code.
197 Returns: 202 Returns:
198 Whether the check succeeded. 203 Whether the check succeeded.
199 """ 204 """
200 205
201 third_party_dirs = _FindThirdPartyDirs() 206 third_party_dirs = _FindThirdPartyDirs()
202 207
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return 1 277 return 1
273 elif args[0] == 'notice': 278 elif args[0] == 'notice':
274 print GenerateNoticeFile() 279 print GenerateNoticeFile()
275 return 0 280 return 0
276 281
277 parser.print_help() 282 parser.print_help()
278 return 1 283 return 1
279 284
280 if __name__ == '__main__': 285 if __name__ == '__main__':
281 sys.exit(main()) 286 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698