|
21 | 21 | "LGPL-3.0-or-later", "MPL-2.0", "EPL-2.0", "CDDL-1.0", |
22 | 22 | }) |
23 | 23 |
|
24 | | -_ALIASES = { |
25 | | - "mit license": "MIT", "the mit license": "MIT", "mit": "MIT", |
26 | | - "apache 2.0": "Apache-2.0", "apache-2": "Apache-2.0", |
27 | | - "apache 2": "Apache-2.0", "apache2": "Apache-2.0", |
28 | | - "apache software license": "Apache-2.0", "apache license 2.0": "Apache-2.0", |
29 | | - "bsd": "BSD-3-Clause", "bsd license": "BSD-3-Clause", |
30 | | - "new bsd license": "BSD-3-Clause", "gplv2": "GPL-2.0-only", |
31 | | - "gplv3": "GPL-3.0-only", "gnu gplv3": "GPL-3.0-only", |
32 | | - "lgplv3": "LGPL-3.0-only", "mpl 2.0": "MPL-2.0", "isc license": "ISC", |
| 24 | +# Canonical SPDX id -> the loose names that should normalize to it. Inverted |
| 25 | +# below so each SPDX id literal appears exactly once (no duplicated literals). |
| 26 | +_ALIAS_GROUPS = { |
| 27 | + "MIT": ("mit license", "the mit license", "mit"), |
| 28 | + "Apache-2.0": ("apache 2.0", "apache-2", "apache 2", "apache2", |
| 29 | + "apache software license", "apache license 2.0"), |
| 30 | + "BSD-3-Clause": ("bsd", "bsd license", "new bsd license"), |
| 31 | + "GPL-2.0-only": ("gplv2",), |
| 32 | + "GPL-3.0-only": ("gplv3", "gnu gplv3"), |
| 33 | + "LGPL-3.0-only": ("lgplv3",), |
| 34 | + "MPL-2.0": ("mpl 2.0",), |
| 35 | + "ISC": ("isc license",), |
33 | 36 | } |
| 37 | +_ALIASES = {alias: spdx for spdx, names in _ALIAS_GROUPS.items() |
| 38 | + for alias in names} |
34 | 39 |
|
35 | 40 | _OPERATOR_RE = re.compile(r"\b(?:OR|AND|WITH)\b|[()]", re.IGNORECASE) |
36 | 41 |
|
|
0 commit comments