Host SPDX licenses on Bintray, Github is blocked in multiple countries

This commit is contained in:
Ivan Kravets
2020-09-07 13:16:08 +03:00
parent c7758fd30e
commit 65b1029216

View File

@ -242,7 +242,7 @@ class ManifestSchema(BaseSchema):
raise ValidationError("Could not load SPDX licenses for validation") raise ValidationError("Could not load SPDX licenses for validation")
for item in spdx.get("licenses", []): for item in spdx.get("licenses", []):
if item.get("licenseId") == value: if item.get("licenseId") == value:
return return True
raise ValidationError( raise ValidationError(
"Invalid SPDX license identifier. See valid identifiers at " "Invalid SPDX license identifier. See valid identifiers at "
"https://spdx.org/licenses/" "https://spdx.org/licenses/"
@ -251,9 +251,5 @@ class ManifestSchema(BaseSchema):
@staticmethod @staticmethod
@memoized(expire="1h") @memoized(expire="1h")
def load_spdx_licenses(): def load_spdx_licenses():
version = "3.10" spdx_data_url = "https://dl.bintray.com/platformio/dl-misc/spdx-licenses-3.json"
spdx_data_url = (
"https://raw.githubusercontent.com/spdx/license-list-data"
"/v%s/json/licenses.json" % version
)
return json.loads(fetch_remote_content(spdx_data_url)) return json.loads(fetch_remote_content(spdx_data_url))