diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2015-05-08 20:41:29 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-09 22:28:14 +0100 |
commit | 8c7082de0ad2a963b5823834a83723127ddb454e (patch) | |
tree | 8d66960351cba20ebacc6544ef7a5dee14a93937 /meta/lib/oe | |
parent | b971eb0313f483b0a0653189a8f56921cc242901 (diff) | |
download | poky-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')
-rw-r--r-- | meta/lib/oe/license.py | 14 |
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 | |||
5 | import re | 5 | import re |
6 | from fnmatch import fnmatchcase as fnmatch | 6 | from fnmatch import fnmatchcase as fnmatch |
7 | 7 | ||
8 | def 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 | |||
8 | class LicenseError(Exception): | 22 | class LicenseError(Exception): |
9 | pass | 23 | pass |
10 | 24 | ||