Update package licensing and return package based on the `license` and `licenses` values found in a package. Licensing data structure has evolved over time and is a tad messy. https://docs.npmjs.com/files/package.json#license license(s) is either: - a string with: - an
(license, licenses, package)
| 1640 | |
| 1641 | |
| 1642 | def licenses_mapper(license, licenses, package): # NOQA |
| 1643 | """ |
| 1644 | Update package licensing and return package based on the `license` and |
| 1645 | `licenses` values found in a package. |
| 1646 | |
| 1647 | Licensing data structure has evolved over time and is a tad messy. |
| 1648 | https://docs.npmjs.com/files/package.json#license |
| 1649 | license(s) is either: |
| 1650 | - a string with: |
| 1651 | - an SPDX id or expression { "license" : "(ISC OR GPL-3.0)" } |
| 1652 | - some license name or id |
| 1653 | - "SEE LICENSE IN <filename>" |
| 1654 | - (Deprecated) an array or a list of arrays of type, url. |
| 1655 | - "license": "UNLICENSED" means this is proprietary |
| 1656 | """ |
| 1657 | declared_license = get_declared_licenses(license) or [] |
| 1658 | declared_license.extend(get_declared_licenses(licenses) or []) |
| 1659 | if declared_license: |
| 1660 | package.extracted_license_statement = declared_license |
| 1661 | return package |
| 1662 | |
| 1663 | |
| 1664 | def party_mapper(party, package, party_type): |
no test coverage detected