diff options
author | Alan Jeffrey <ajeffrey@mozilla.com> | 2016-07-14 11:24:29 -0500 |
---|---|---|
committer | Alan Jeffrey <ajeffrey@mozilla.com> | 2016-07-14 11:24:29 -0500 |
commit | 9fa54af34794df663d02634860b8a6586f47f81b (patch) | |
tree | ffaa63d74fb688e69217ad1992e14c6b8357ef6a /python/tidy/servo_tidy | |
parent | 62e95c5a6192df4ecc8fd17a25200bb2188795d5 (diff) | |
download | servo-9fa54af34794df663d02634860b8a6586f47f81b.tar.gz servo-9fa54af34794df663d02634860b8a6586f47f81b.zip |
Allow MIT/Apache-2.0 license as well as MPL-2.0.
Diffstat (limited to 'python/tidy/servo_tidy')
-rw-r--r-- | python/tidy/servo_tidy/licenseck.py | 6 | ||||
-rw-r--r-- | python/tidy/servo_tidy/tidy.py | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/python/tidy/servo_tidy/licenseck.py b/python/tidy/servo_tidy/licenseck.py index ce5fdee075d..40bdfb8e5d8 100644 --- a/python/tidy/servo_tidy/licenseck.py +++ b/python/tidy/servo_tidy/licenseck.py @@ -82,3 +82,9 @@ licenses = [ // except according to those terms. """, ] # noqa: Indicate to flake8 that we do not want to check indentation here + +# The valid licenses, in the form we'd expect to see them in a Cargo.toml file. +licenses_toml = [ + 'license = "MPL-2.0"', + 'license = "MIT/Apache-2.0"', +] diff --git a/python/tidy/servo_tidy/tidy.py b/python/tidy/servo_tidy/tidy.py index 23140de9987..fc52fbedd82 100644 --- a/python/tidy/servo_tidy/tidy.py +++ b/python/tidy/servo_tidy/tidy.py @@ -17,7 +17,7 @@ import site import StringIO import subprocess import sys -from licenseck import licenses +from licenseck import licenses, licenses_toml # License and header checks EMACS_HEADER = "/* -*- Mode:" @@ -295,13 +295,14 @@ duplicate versions for package "{package}" def check_toml(file_name, lines): if not file_name.endswith(".toml"): raise StopIteration - mpl_licensed = False + ok_licensed = False for idx, line in enumerate(lines): if line.find("*") != -1: yield (idx + 1, "found asterisk instead of minimum version number") - mpl_licensed |= ('license = "MPL-2.0"' in line) - if not mpl_licensed: - yield (0, ".toml file should contain MPL-2.0 license.") + for license in licenses_toml: + ok_licensed |= (license in line) + if not ok_licensed: + yield (0, ".toml file should contain a valid license.") def check_rust(file_name, lines): |