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 /tools/licenses.py | |
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 'tools/licenses.py')
-rwxr-xr-x | tools/licenses.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/licenses.py b/tools/licenses.py index 8feda9c..d5bd316 100755 --- a/tools/licenses.py +++ b/tools/licenses.py @@ -234,7 +234,7 @@ def AbsolutePath(path, filename): return absolute_path return None -def ParseDir(path): +def ParseDir(path, require_license_file=True): """Examine a third_party/foo component and extract its metadata.""" # Parse metadata fields out of README.chromium. @@ -282,15 +282,15 @@ def ParseDir(path): for filename in (metadata["License File"], "COPYING"): license_path = AbsolutePath(path, filename) if license_path is not None: - metadata["License File"] = license_path break - if not license_path: + if require_license_file and not license_path: raise LicenseError("License file not found. " "Either add a file named LICENSE, " "import upstream's COPYING if available, " "or add a 'License File:' line to " "README.chromium with the appropriate path.") + metadata["License File"] = license_path if "Required Text" in metadata: required_path = AbsolutePath(path, metadata["Required Text"]) |