We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d16e5ef + 2bc5f20 commit 11bae51Copy full SHA for 11bae51
3 files changed
liccheck/command_line.py
@@ -223,16 +223,16 @@ def check_one(license_str, license_rule="AUTHORIZED", as_regex=False):
223
224
at_least_one_unauthorized = False
225
count_authorized = 0
226
- for license in pkg["licenses"]:
227
- lower = license.lower()
+ licenses = get_license_names(pkg["licenses"])
+ for license in licenses:
228
if check_one(
229
- lower,
+ license,
230
license_rule="UNAUTHORIZED",
231
as_regex=as_regex,
232
):
233
at_least_one_unauthorized = True
234
235
236
license_rule="AUTHORIZED",
237
238
@@ -247,7 +247,7 @@ def check_one(license_str, license_rule="AUTHORIZED", as_regex=False):
247
)
248
or (
249
count_authorized
250
- and count_authorized == len(pkg["licenses"])
+ and count_authorized == len(licenses)
251
and level is Level.PARANOID
252
253
@@ -259,6 +259,14 @@ def check_one(license_str, license_rule="AUTHORIZED", as_regex=False):
259
260
return Reason.UNKNOWN
261
262
+def get_license_names(licenses):
263
+ names = []
264
265
+ license = license.lower()
266
+ options = license.split(" or ")
267
+ for option in options:
268
+ names.append(option)
269
+ return names
270
271
def find_parents(package, all, seen):
272
if package in seen:
test-requirements.txt
@@ -3,3 +3,4 @@ pytest-cov
3
python-openid;python_version<="2.7"
4
python3-openid;python_version>="3.0"
5
pytest-mock>=1.10
6
+tox
tests/test_check_package.py
@@ -25,6 +25,11 @@ def packages():
25
"version": "1",
26
"licenses": ["authorized 1", "unauthorized 1"],
27
},
28
+ {
29
+ "name": "auth_one_or_unauth_one",
30
+ "version": "2",
31
+ "licenses": ["authorized 1 or unauthorized 1"],
32
+ },
33
{
34
"name": "unauth_one",
35
"version": "2",
@@ -77,9 +82,9 @@ def packages():
77
82
@pytest.mark.parametrize(
78
83
("level", "reasons"),
79
84
[
80
- (Level.STANDARD, [OK, OK, OK, UNAUTH, OK, UNAUTH, OK, UNKNOWN]),
81
- (Level.CAUTIOUS, [OK, OK, UNAUTH, UNAUTH, OK, UNAUTH, OK, UNKNOWN]),
- (Level.PARANOID, [OK, OK, UNAUTH, UNAUTH, OK, UNAUTH, UNKNOWN, UNKNOWN]),
85
+ (Level.STANDARD, [OK, OK, OK, OK, UNAUTH, OK, UNAUTH, OK, UNKNOWN]),
86
+ (Level.CAUTIOUS, [OK, OK, UNAUTH, UNAUTH, UNAUTH, OK, UNAUTH, OK, UNKNOWN]),
87
+ (Level.PARANOID, [OK, OK, UNAUTH, UNAUTH, UNAUTH, OK, UNAUTH, UNKNOWN, UNKNOWN]),
88
],
89
ids=[level.name for level in Level],
90
0 commit comments