mirror of
https://git.yoctoproject.org/poky
synced 2026-09-24 22:36:21 +02:00
license_class: Generalize license_ok function
Add dont_want_licenses as parameter to license_ok function and move it to oe.license module in order to use in other modules. (From OE-Core rev: 243fe3a4583a21ad6c0b2a26196ed18d41740f7a) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
b971eb0313
commit
8c7082de0a
@@ -5,6 +5,20 @@ import ast
|
||||
import re
|
||||
from fnmatch import fnmatchcase as fnmatch
|
||||
|
||||
def license_ok(license, dont_want_licenses):
|
||||
""" Return False if License exist in dont_want_licenses else True """
|
||||
for dwl in dont_want_licenses:
|
||||
# If you want to exclude license named generically 'X', we
|
||||
# surely want to exclude 'X+' as well. In consequence, we
|
||||
# will exclude a trailing '+' character from LICENSE in
|
||||
# case INCOMPATIBLE_LICENSE is not a 'X+' license.
|
||||
lic = license
|
||||
if not re.search('\+$', dwl):
|
||||
lic = re.sub('\+', '', license)
|
||||
if fnmatch(lic, dwl):
|
||||
return False
|
||||
return True
|
||||
|
||||
class LicenseError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user