diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-01-23 21:05:04 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-01-23 21:05:04 +0000 |
commit | 299e46aaf1c89b6380660cbffeea9caf7593d072 (patch) | |
tree | 4dd3c7f725b4219bdb0610c3af7068022009109a | |
parent | b35e61fd556aa75cc80656c8063a48c93998bf87 (diff) | |
parent | 1ef53f9a54e49a1de89527f35410bb67459a22cf (diff) | |
download | development-299e46aaf1c89b6380660cbffeea9caf7593d072.tar.gz |
Merge "add3prf.py: Add detection of LICENSE-BSD file" into main
-rwxr-xr-x | scripts/add3prf.py | 4 | ||||
-rwxr-xr-x | scripts/add3prf_test.py | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/scripts/add3prf.py b/scripts/add3prf.py index 60dfcc101..6c8185a57 100755 --- a/scripts/add3prf.py +++ b/scripts/add3prf.py @@ -207,8 +207,10 @@ def decide_license_type(cargo_license): lowered_name = os.path.splitext(license_file.lower())[0] if lowered_name == "license-apache": licenses.append(License(LicenseType.APACHE2, LicenseGroup.NOTICE, license_file)) - if lowered_name == "license-boost": + elif lowered_name == "license-boost": licenses.append(License(LicenseType.BOOST, LicenseGroup.NOTICE, license_file)) + elif lowered_name == "license-bsd": + licenses.append(License(LicenseType.BSD_LIKE, LicenseGroup.NOTICE, license_file)) elif lowered_name == "license-mit": licenses.append(License(LicenseType.MIT, LicenseGroup.NOTICE, license_file)) elif lowered_name == "license-0bsd": diff --git a/scripts/add3prf_test.py b/scripts/add3prf_test.py index ecaf5194a..4cb93f4b7 100755 --- a/scripts/add3prf_test.py +++ b/scripts/add3prf_test.py @@ -154,6 +154,15 @@ class LicenseDetectionTestCase(fake_filesystem_unittest.TestCase): self.assertEqual(preferred_license.group, add3prf.LicenseGroup.NOTICE) self.assertEqual(preferred_license.filename, "LICENSE-BOOST") + def test_bsd_licensefile(self): + self.fs.create_file("LICENSE-BSD") + licenses = add3prf.decide_license_type("") + self.assertEqual(len(licenses), 1) + preferred_license = licenses[0] + self.assertEqual(preferred_license.type, add3prf.LicenseType.BSD_LIKE) + self.assertEqual(preferred_license.group, add3prf.LicenseGroup.NOTICE) + self.assertEqual(preferred_license.filename, "LICENSE-BSD") + class AddModuleLicenseTestCase(fake_filesystem_unittest.TestCase): def setUp(self): |