mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 00:49:33 +02:00
oe/licenses: move tidy_licenses from recipetool
This function, to tidy a license string, is useful outside of recipetool so move it to oe.license. (From OE-Core rev: 9d57b53169bc60b281510c49e54123941a17a8f5) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
90cc27f8ce
commit
72486700fb
@@ -462,3 +462,18 @@ def skip_incompatible_package_licenses(d, pkgs):
|
||||
skipped_pkgs[pkg] = incompatible_lic
|
||||
|
||||
return skipped_pkgs
|
||||
|
||||
def tidy_licenses(value):
|
||||
"""
|
||||
Flat, split and sort licenses.
|
||||
"""
|
||||
from oe.license import flattened_licenses
|
||||
|
||||
def _choose(a, b):
|
||||
str_a, str_b = sorted((" & ".join(a), " & ".join(b)), key=str.casefold)
|
||||
return ["(%s | %s)" % (str_a, str_b)]
|
||||
|
||||
if not isinstance(value, str):
|
||||
value = " & ".join(value)
|
||||
|
||||
return sorted(list(set(flattened_licenses(value, _choose))), key=str.casefold)
|
||||
|
||||
Reference in New Issue
Block a user