summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/license.py
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2015-05-08 20:41:29 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-09 22:28:14 +0100
commit8c7082de0ad2a963b5823834a83723127ddb454e (patch)
tree8d66960351cba20ebacc6544ef7a5dee14a93937 /meta/lib/oe/license.py
parentb971eb0313f483b0a0653189a8f56921cc242901 (diff)
downloadpoky-8c7082de0ad2a963b5823834a83723127ddb454e.tar.gz
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>
Diffstat (limited to 'meta/lib/oe/license.py')
-rw-r--r--meta/lib/oe/license.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index 31ca15b574..bc146a28c4 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -5,6 +5,20 @@ import ast
5import re 5import re
6from fnmatch import fnmatchcase as fnmatch 6from fnmatch import fnmatchcase as fnmatch
7 7
8def license_ok(license, dont_want_licenses):
9 """ Return False if License exist in dont_want_licenses else True """
10 for dwl in dont_want_licenses:
11 # If you want to exclude license named generically 'X', we
12 # surely want to exclude 'X+' as well. In consequence, we
13 # will exclude a trailing '+' character from LICENSE in
14 # case INCOMPATIBLE_LICENSE is not a 'X+' license.
15 lic = license
16 if not re.search('\+$', dwl):
17 lic = re.sub('\+', '', license)
18 if fnmatch(lic, dwl):
19 return False
20 return True
21
8class LicenseError(Exception): 22class LicenseError(Exception):
9 pass 23 pass
10 24