From b0c649655e7035d1a3fd2df81c1bd4ca90e4c2f8 Mon Sep 17 00:00:00 2001 From: jNullj <15849761+jNullj@users.noreply.github.com> Date: Wed, 17 Apr 2024 18:36:14 +0300 Subject: [PATCH] Add 0BSD license to licenseTypes and [PypiLicense] (#10092) Part of issue #10058 --- services/licenses.js | 2 +- services/licenses.spec.js | 2 +- services/pypi/pypi-helpers.js | 1 + services/pypi/pypi-helpers.spec.js | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/services/licenses.js b/services/licenses.js index 349e6980f48ae..bef445cc6865e 100644 --- a/services/licenses.js +++ b/services/licenses.js @@ -87,7 +87,7 @@ const licenseTypes = { }, // public domain licenses do not require 'License and copyright notice' (https://choosealicense.com/appendix/#include-copyright) 'public-domain': { - spdxLicenseIds: ['CC0-1.0', 'Unlicense', 'WTFPL'], + spdxLicenseIds: ['CC0-1.0', 'Unlicense', 'WTFPL', '0BSD'], aliases: ['CC0'], color: '7cd958', priority: '3', diff --git a/services/licenses.spec.js b/services/licenses.spec.js index 982b06cccb9ca..a82d10f5be8d7 100644 --- a/services/licenses.spec.js +++ b/services/licenses.spec.js @@ -5,7 +5,7 @@ describe('license helpers', function () { test(licenseToColor, () => { forCases([given('MIT'), given('BSD')]).expect('green') forCases([given('MPL-2.0'), given('MPL')]).expect('orange') - forCases([given('Unlicense'), given('CC0')]).expect('7cd958') + forCases([given('Unlicense'), given('CC0'), given('0BSD')]).expect('7cd958') forCases([given('unknown-license'), given(null)]).expect('lightgrey') given(['CC0-1.0', 'MPL-2.0']).expect('7cd958') diff --git a/services/pypi/pypi-helpers.js b/services/pypi/pypi-helpers.js index 4a5f212c0f773..41a8b6f9d4705 100644 --- a/services/pypi/pypi-helpers.js +++ b/services/pypi/pypi-helpers.js @@ -69,6 +69,7 @@ function getLicenses(packageData) { 'OSI Approved :: Apache Software License': 'Apache-2.0', 'CC0 1.0 Universal (CC0 1.0) Public Domain Dedication': 'CC0-1.0', 'OSI Approved :: GNU Affero General Public License v3': 'AGPL-3.0', + 'OSI Approved :: Zero-Clause BSD (0BSD)': '0BSD', } let licenses = parseClassifiers(packageData, /^License :: (.+)$/, true) .map(classifier => diff --git a/services/pypi/pypi-helpers.spec.js b/services/pypi/pypi-helpers.spec.js index 1fe20ffc4903a..2762af6759d23 100644 --- a/services/pypi/pypi-helpers.spec.js +++ b/services/pypi/pypi-helpers.spec.js @@ -167,6 +167,12 @@ describe('PyPI helpers', function () { ], }, }).expect(['AGPL-3.0']) + given({ + info: { + license: '', + classifiers: ['License :: OSI Approved :: Zero-Clause BSD (0BSD)'], + }, + }).expect(['0BSD']) }) test(getPackageFormats, () => {