summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@windriver.com>2022-02-24 13:55:33 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-25 12:41:24 +0000
commite62965346314544919e4a529ca860a242d76b303 (patch)
tree143e1a3fa8f1feb13c9a9ed631d6a37d425e0ce2
parentfc2b2c7927acc8047d71433342e73912b93405f7 (diff)
downloadpoky-e62965346314544919e4a529ca860a242d76b303.tar.gz
license.py: rename variables
Update the comment to reflect new variable names (From OE-Core rev: 7fbab1aefc127f0e1834f51a8a793b0d7e7b4f07) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/license.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py
index b5d378a549..b1105f6149 100644
--- a/meta/lib/oe/license.py
+++ b/meta/lib/oe/license.py
@@ -99,26 +99,29 @@ def flattened_licenses(licensestr, choose_licenses):
99 raise LicenseSyntaxError(licensestr, exc) 99 raise LicenseSyntaxError(licensestr, exc)
100 return flatten.licenses 100 return flatten.licenses
101 101
102def is_included(licensestr, whitelist=None, blacklist=None): 102def is_included(licensestr, include_licenses=None, exclude_licenses=None):
103 """Given a license string and whitelist and blacklist, determine if the 103 """Given a license a list of list to include and a list of
104 license string matches the whitelist and does not match the blacklist. 104 licenses to exclude, determine if the license string
105 105 matches the an include list and does not match the
106 Returns a tuple holding the boolean state and a list of the applicable 106 exclude list.
107 licenses that were excluded if state is False, or the licenses that were 107
108 included if the state is True. 108 Returns a tuple holding the boolean state and a list of
109 the applicable licenses that were excluded if state is
110 False, or the licenses that were included if the state
111 is True.
109 """ 112 """
110 113
111 def include_license(license): 114 def include_license(license):
112 return any(fnmatch(license, pattern) for pattern in whitelist) 115 return any(fnmatch(license, pattern) for pattern in include_licenses)
113 116
114 def exclude_license(license): 117 def exclude_license(license):
115 return any(fnmatch(license, pattern) for pattern in blacklist) 118 return any(fnmatch(license, pattern) for pattern in exclude_licenses)
116 119
117 def choose_licenses(alpha, beta): 120 def choose_licenses(alpha, beta):
118 """Select the option in an OR which is the 'best' (has the most 121 """Select the option in an OR which is the 'best' (has the most
119 included licenses and no excluded licenses).""" 122 included licenses and no excluded licenses)."""
120 # The factor 1000 below is arbitrary, just expected to be much larger 123 # The factor 1000 below is arbitrary, just expected to be much larger
121 # that the number of licenses actually specified. That way the weight 124 # than the number of licenses actually specified. That way the weight
122 # will be negative if the list of licenses contains an excluded license, 125 # will be negative if the list of licenses contains an excluded license,
123 # but still gives a higher weight to the list with the most included 126 # but still gives a higher weight to the list with the most included
124 # licenses. 127 # licenses.
@@ -131,11 +134,11 @@ def is_included(licensestr, whitelist=None, blacklist=None):
131 else: 134 else:
132 return beta 135 return beta
133 136
134 if not whitelist: 137 if not include_licenses:
135 whitelist = ['*'] 138 include = ['*']
136 139
137 if not blacklist: 140 if not exclude_licenses:
138 blacklist = [] 141 exclude = []
139 142
140 licenses = flattened_licenses(licensestr, choose_licenses) 143 licenses = flattened_licenses(licensestr, choose_licenses)
141 excluded = [lic for lic in licenses if exclude_license(lic)] 144 excluded = [lic for lic in licenses if exclude_license(lic)]