Commit a3a05334 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 38123d51
......@@ -497,38 +497,46 @@ def removesuffix(s, suffix):
# it is an error is license_name cannot be recognized.
_licdb = { # spdx -> variants
'Apache-2.0': 'Apache License 2.0 | Apache License, Version 2.0 | http://www.apache.org/licenses/LICENSE-2.0',
'BSD-2-Clause': '2-Clause BSD',
'BSD-3-Clause': '3-clause BSD License | BSD 3-Clause License | BSD (3-clause)',
'CNRI-Python': 'Python License (CNRI Python License)',
'EPL-1.0': 'Eclipse Public License 1.0',
'HPND': '',
'ISC': 'ISC license',
'LGPL-2.1': '',
'GPL-2.0+': 'GPL 2+',
'GPL-3.0+': 'GNU GPLv3+',
'GPL-3.0': 'GPLv3 | GNU General Public License Version 3',
'GPL-3.0': 'GPLv3 | GPL3 | GNU General Public License Version 3',
'MIT': 'MIT License',
'ZPL-2.1': '',
'MPL-2.0': '',
'ZPL-2.1': 'ZPL 2.1 (http://www.zope.org/Resources/License/ZPL-2.1)',
'GPL-3.0+-with-NXD-exception': 'GPLv3+ with wide exception for FOSS | GPLv3+ with wide exception for Open-Source',
# XXX no versions
'BSD': 'OSI Approved :: BSD License',
'BSD': 'BSD License | OSI Approved :: BSD License',
'GPL': '',
'LGPL': '',
'PSF': 'Python Software Foundation License',
'PSF': 'PSF license | Python Software Foundation License',
}
_licrevdb = {} # variant -> spdx
for lic, variants in _licdb.items():
vv = []
if variants:
vv = variants.split('|')
vv.append(lic) # e.g. MIT -> MIT
vv.append(lic) # MIT -> MIT
vv.append('"%s"' % lic) # "MIT" -> MIT
licsp = lic.replace('-', ' ')
if licsp != lic:
vv.append(licsp) # e.g. ZPL 2.1 -> ZPL-2.1
vv.append(licsp) # ZPL 2.1 -> ZPL-2.1
for v in vv:
v = v.strip()
assert v not in _licrevdb, repr(v)
_licrevdb[v] = lic
def spdx_license_canon(license_name):
# XXX split on ; and 'and' ?
# XXX split on ';' ',' 'and' 'or'
# XXX split as if list ['MIT', 'BSD'] (pystemmer)
license_name = license_name.strip()
spdx = _licrevdb.get(license_name)
if spdx is None:
return license_name # XXX temp
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment