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

Unified Diff: android_webview/tools/webview_licenses.py

Issue 10829272: Add a function to provide the list of third-party directories which are incompatible with Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up regex Created 8 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/README.chromium.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/tools/webview_licenses.py
diff --git a/android_webview/tools/webview_licenses.py b/android_webview/tools/webview_licenses.py
index e15e164cb9a007a93bd958a6b8b6a853c310ecac..9e766dc77629057fa46076b543b14a804da757ae 100755
--- a/android_webview/tools/webview_licenses.py
+++ b/android_webview/tools/webview_licenses.py
@@ -31,6 +31,40 @@ sys.path.append(os.path.join(REPOSITORY_ROOT, 'tools'))
import licenses
+def GetIncompatibleDirectories():
+ """Gets a list of third-party directories which use licenses incompatible
+ with Android. This is used by the snapshot tool.
+ Returns:
+ A list of directories.
+ """
+
+ whitelist = [
+ 'Apache( Version)? 2(\.0)?',
+ '(New )?BSD( 3-Clause)?( with advertising clause)?',
+ 'L?GPL ?v?2(\.[01])?( or later)?',
Nico 2012/08/10 00:36:48 You're whitelisting GPL?
Steve Block 2012/08/10 07:55:22 GPL v2, yes. While we can't include GPL v2 code in
+ 'MIT(/X11)?(-like)?',
+ 'MPL 1\.1 ?/ ?GPL 2(\.0)? ?/ ?LGPL 2\.1',
+ 'Microsoft Limited Public License',
+ 'Microsoft Permissive License',
+ 'Public Domain',
+ 'SGI Free Software License B',
+ 'X11',
+ ]
+ regex = '^(%s)$' % '|'.join(whitelist)
+ result = []
+ for directory in _FindThirdPartyDirs():
+ metadata = licenses.ParseDir(directory)
+ if metadata.get('Android Compatibility', 'no') == 'yes':
Nico 2012/08/10 16:42:16 nit: "Android Compatibility: yes" reads weird to m
+ continue
+ license = re.split(' [Ll]icenses?$', metadata['License'])[0]
+ tokens = [x.strip() for x in re.split(' and |,', license) if len(x) > 0]
+ for token in tokens:
+ if not re.match(regex, token, re.IGNORECASE):
+ result.append(directory)
+ break
+ return result
+
+
def _CheckLicenseHeaders(directory_list, whitelisted_files):
"""Checks that all files which are not in a listed third-party directory,
and which do not use the standard Chromium license, are whitelisted.
« no previous file with comments | « no previous file | third_party/README.chromium.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698