diff options
author | steveblock@chromium.org <steveblock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-17 16:37:32 +0000 |
---|---|---|
committer | steveblock@chromium.org <steveblock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-17 16:37:32 +0000 |
commit | 2bb8cf46239ff12dde77b42644820a82e38ea9e6 (patch) | |
tree | c503f87f9b7055ffaf0f32fb4d8925f2ad9fbfdc /android_webview | |
parent | 947c9c0bfffc99b282a7d1eed4307265b9f8138d (diff) | |
download | chromium_src-2bb8cf46239ff12dde77b42644820a82e38ea9e6.zip chromium_src-2bb8cf46239ff12dde77b42644820a82e38ea9e6.tar.gz chromium_src-2bb8cf46239ff12dde77b42644820a82e38ea9e6.tar.bz2 |
Make checking the existence of the license file optional in the license tool
This is useful in situations where a checkout excludes some DEPS directories.
In this case, a checkout may include the README.chromium file for a particular
third-party project, but not the license file to which it refers.
This change adds a new require_license_file argument to licenses.ParseDir(), with
a default value of true. When true, there is no change in behaviour and if the
license file is missing, an exception is raised. When false, if the license
file is missing, we simply set the value of the 'License File' field of the
returned metadata to None.
This change also makes use of the new feature in
webview_licenses.GetIncompatibleDirectories() and
webview_licenses.GenerateNoticeFile().
BUG=138921
Review URL: https://chromiumcodereview.appspot.com/10829355
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rwxr-xr-x | android_webview/tools/webview_licenses.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/android_webview/tools/webview_licenses.py b/android_webview/tools/webview_licenses.py index 338a426..b432895 100755 --- a/android_webview/tools/webview_licenses.py +++ b/android_webview/tools/webview_licenses.py @@ -53,7 +53,7 @@ def GetIncompatibleDirectories(): regex = '^(%s)$' % '|'.join(whitelist) result = [] for directory in _FindThirdPartyDirs(): - metadata = licenses.ParseDir(directory) + metadata = licenses.ParseDir(directory, require_license_file=False) if metadata.get('License Android Compatible', 'no') == 'yes': continue license = re.split(' [Ll]icenses?$', metadata['License'])[0] @@ -193,10 +193,9 @@ def _Scan(): and all_licenses_valid -def _GenerateNoticeFile(print_warnings): +def GenerateNoticeFile(): """Generates the contents of an Android NOTICE file for the third-party code. - Args: - print_warnings: Whether to print warnings. + This is used by the snapshot tool. Returns: The contents of the NOTICE file. """ @@ -209,8 +208,9 @@ def _GenerateNoticeFile(print_warnings): # We provide attribution for all third-party directories. # TODO(steveblock): Limit this to only code used by the WebView binary. for directory in third_party_dirs: - license_file = licenses.ParseDir(directory)['License File'] - if license_file != licenses.NOT_SHIPPED: + metadata = licenses.ParseDir(directory, require_license_file=False) + license_file = metadata['License File'] + if license_file and license_file != licenses.NOT_SHIPPED: content.append(_ReadFile(license_file)) return '\n'.join(content) @@ -245,7 +245,7 @@ def main(): else: return 1 elif args[0] == 'notice': - print _GenerateNoticeFile(print_warnings=False) + print GenerateNoticeFile() return 0 parser.print_help() |