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

Unified Diff: tools/licenses.py

Issue 660163002: Collect license version as an optional_key in licenses.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed Required Text functionality Created 6 years, 2 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 | « chrome/browser/resources/about_credits_entry.tmpl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/licenses.py
diff --git a/tools/licenses.py b/tools/licenses.py
index ccebfaeb92d8c18d6ad58aac7a4010c4ae499d27..aabed42d8291784d44fa508e30c35a17498c0acc 100755
--- a/tools/licenses.py
+++ b/tools/licenses.py
@@ -254,7 +254,7 @@ def AbsolutePath(path, filename, root):
return absolute_path
return None
-def ParseDir(path, root, require_license_file=True):
+def ParseDir(path, root, require_license_file=True, optional_keys=None):
"""Examine a third_party/foo component and extract its metadata."""
# Parse metadata fields out of README.chromium.
@@ -266,9 +266,8 @@ def ParseDir(path, root, require_license_file=True):
"License": None, # Software license.
}
- # Relative path to a file containing some html we're required to place in
- # about:credits.
- optional_keys = ["Required Text", "License Android Compatible"]
+ if optional_keys is None:
+ optional_keys = []
if path in SPECIAL_CASES:
metadata.update(SPECIAL_CASES[path])
@@ -312,13 +311,6 @@ def ParseDir(path, root, require_license_file=True):
"README.chromium with the appropriate path.")
metadata["License File"] = license_path
- if "Required Text" in metadata:
- required_path = AbsolutePath(path, metadata["Required Text"], root)
- if required_path is not None:
- metadata["Required Text"] = required_path
- else:
- raise LicenseError("Required text file listed but not found.")
-
return metadata
@@ -412,7 +404,7 @@ def GenerateCredits():
"""Expand a template with variables like {{foo}} using a
dictionary of expansions."""
for key, val in env.items():
- if escape and not key.endswith("_unescaped"):
+ if escape:
val = cgi.escape(val)
template = template.replace('{{%s}}' % key, val)
return template
@@ -435,11 +427,7 @@ def GenerateCredits():
'name': metadata['Name'],
'url': metadata['URL'],
'license': open(metadata['License File'], 'rb').read(),
- 'license_unescaped': '',
}
- if 'Required Text' in metadata:
- required_text = open(metadata['Required Text'], 'rb').read()
- env["license_unescaped"] = required_text
entries.append(EvaluateTemplate(entry_template, env))
file_template = open(os.path.join(root, 'chrome', 'browser', 'resources',
« no previous file with comments | « chrome/browser/resources/about_credits_entry.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698