We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da7917a commit 607d58eCopy full SHA for 607d58e
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
- licenses = get_license_names(pkg["licenses"])
227
- for license in licenses:
+ for license in pkg["licenses"]:
+ lower = license.lower()
228
if check_one(
229
- license,
+ lower,
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(licenses)
+ and count_authorized == len(pkg["licenses"])
251
and level is Level.PARANOID
252
253
@@ -259,14 +259,6 @@ 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,4 +3,3 @@ 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,11 +25,6 @@ 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",
@@ -82,9 +77,9 @@ def packages():
82
77
@pytest.mark.parametrize(
83
78
("level", "reasons"),
84
79
[
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]),
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]),
88
],
89
ids=[level.name for level in Level],
90
0 commit comments