summaryrefslogtreecommitdiffstats
path: root/tools/licenses.py
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 23:56:19 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 23:56:19 +0000
commite657bfcfb7f9f0f92c496cf28631d87d1a022a1c (patch)
tree99ef7934dd281c3cdead7137112ed544e4c01983 /tools/licenses.py
parent069478a79826ba9ec691cb0da6f7f716c375113e (diff)
downloadchromium_src-e657bfcfb7f9f0f92c496cf28631d87d1a022a1c.zip
chromium_src-e657bfcfb7f9f0f92c496cf28631d87d1a022a1c.tar.gz
chromium_src-e657bfcfb7f9f0f92c496cf28631d87d1a022a1c.tar.bz2
Add licensing info for another set of projects in third_party.
Allow special cases in licenses.py for when we pull code directly from an upstream and can't check in a README.chromium. (In particular, we'll need this for WebKit.) Review URL: http://codereview.chromium.org/1075015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42288 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/licenses.py')
-rwxr-xr-xtools/licenses.py45
1 files changed, 31 insertions, 14 deletions
diff --git a/tools/licenses.py b/tools/licenses.py
index cb4ccfb..ec97e85 100755
--- a/tools/licenses.py
+++ b/tools/licenses.py
@@ -32,6 +32,16 @@ PRUNE_DIRS = ('.svn', '.git', # VCS metadata
'out', 'Debug', 'Release', # build files
'layout_tests') # lots of subdirs
+# Directories where we check out directly from upstream, and therefore
+# can't provide a README.chromium. Please prefer a README.chromium
+# wherever possible.
+SPECIAL_CASES = {
+ 'third_party/ots': {
+ "Name": "OTS (OpenType Sanitizer)",
+ "URL": "http://code.google.com/p/ots/",
+ }
+}
+
class LicenseError(Exception):
"""We raise this exception when a directory's licensing info isn't
fully filled out."""
@@ -41,11 +51,6 @@ class LicenseError(Exception):
def ParseDir(path):
"""Examine a third_party/foo component and extract its metadata."""
- # Try to find README.chromium.
- readme_path = os.path.join(path, 'README.chromium')
- if not os.path.exists(readme_path):
- raise LicenseError("missing README.chromium")
-
# Parse metadata fields out of README.chromium.
# We examine "LICENSE" for the license file by default.
metadata = {
@@ -53,20 +58,30 @@ def ParseDir(path):
"Name": None, # Short name (for header on about:credits).
"URL": None, # Project home page.
}
- for line in open(readme_path):
- line = line.strip()
- if not line:
- break
- for key in metadata.keys():
- field = key + ": "
- if line.startswith(field):
- metadata[key] = line[len(field):]
+
+ if path in SPECIAL_CASES:
+ metadata.update(SPECIAL_CASES[path])
+ else:
+ # Try to find README.chromium.
+ readme_path = os.path.join(path, 'README.chromium')
+ if not os.path.exists(readme_path):
+ raise LicenseError("missing README.chromium")
+
+ for line in open(readme_path):
+ line = line.strip()
+ if not line:
+ break
+ for key in metadata.keys():
+ field = key + ": "
+ if line.startswith(field):
+ metadata[key] = line[len(field):]
# Check that all expected metadata is present.
for key, value in metadata.iteritems():
if not value:
raise LicenseError("couldn't find '" + key + "' line "
- "in README.chromium")
+ "in README.chromium or licences.py "
+ "SPECIAL_CASES")
# Check that the license file exists.
for filename in (metadata["License File"], "COPYING"):
@@ -97,6 +112,8 @@ def ScanThirdPartyDirs(third_party_dirs):
continue
print path, "OK:", metadata["License File"]
+ print
+
for path, error in sorted(errors):
print path + ": " + error