Return a URL to the SPDX license either at SPDX, ScanCode or None.
(self)
| 389 | |
| 390 | @property |
| 391 | def spdx_url(self): |
| 392 | """ |
| 393 | Return a URL to the SPDX license either at SPDX, ScanCode or None. |
| 394 | """ |
| 395 | if self.is_builtin: |
| 396 | spdx_license_key = self.spdx_license_key |
| 397 | if not spdx_license_key: |
| 398 | return |
| 399 | |
| 400 | slkl = spdx_license_key.lower() |
| 401 | is_licenseref = slkl.startswith('licenseref-') |
| 402 | |
| 403 | if is_licenseref: |
| 404 | return SCANCODE_LICENSE_URL.format(self.key) |
| 405 | else: |
| 406 | # TODO: Is this replacing spdx_key??? |
| 407 | spdx_license_key = spdx_license_key.rstrip('+') |
| 408 | return SPDX_LICENSE_URL.format(spdx_license_key) |
| 409 | |
| 410 | def license_file(self, licenses_data_dir=licenses_data_dir): |
| 411 | return join(licenses_data_dir, f'{self.key}.LICENSE') |