Commit 38123d51 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 41e34a60
......@@ -100,7 +100,7 @@ def bom_software(installed_software_path): # -> {} (name,kind) -> PkgInfo
if license is None: # XXX temp
license = 'xxx'
# XXX "UNKNOWN" not ok
#license = spdx_license_canon(license)
license = spdx_license_canon(license)
# XXX Eclipse Public License -> EPL (SPDX)
# 3-clause BSD -> BSD-3 ? (SPDX)
# Apache License, Version 2.0
......@@ -496,16 +496,23 @@ 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',
'EPL-1.0': 'Eclipse Public License 1.0',
'GPL-2.0+': 'GPL 2+',
'GPL-3.0+': 'GNU GPLv3+',
'GPL-3.0': 'GPLv3 | GNU General Public License Version 3',
'MIT': '',
'PSF': 'Python Software Foundation License', # XXX no ver
'ZPL-2.1': '',
'GPL-3.0+-with-NXD-exception': 'GPLv3+ with wide exception for FOSS',
'Apache-2.0': 'Apache License 2.0 | Apache License, Version 2.0 | http://www.apache.org/licenses/LICENSE-2.0',
'CNRI-Python': 'Python License (CNRI Python License)',
'EPL-1.0': 'Eclipse Public License 1.0',
'HPND': '',
'GPL-2.0+': 'GPL 2+',
'GPL-3.0+': 'GNU GPLv3+',
'GPL-3.0': 'GPLv3 | GNU General Public License Version 3',
'MIT': 'MIT 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',
'GPL': '',
'LGPL': '',
'PSF': 'Python Software Foundation License',
}
_licrevdb = {} # variant -> spdx
for lic, variants in _licdb.items():
......@@ -521,8 +528,10 @@ for lic, variants in _licdb.items():
assert v not in _licrevdb, repr(v)
_licrevdb[v] = lic
def spdx_license_canon(license_name):
# XXX split on ; and 'and' ?
spdx = _licrevdb.get(license_name)
if spdx is None:
return license_name # XXX temp
raise ValueError('unknown license %r' % license_name)
return spdx
......
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