Skip to content

Commit 607d58e

Browse files
author
Olivier Chédru
committed
Revert "Merge pull request #100 from thehale/master"
This reverts commit 11bae51, reversing changes made to d16e5ef.
1 parent da7917a commit 607d58e

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

liccheck/command_line.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,16 @@ def check_one(license_str, license_rule="AUTHORIZED", as_regex=False):
223223

224224
at_least_one_unauthorized = False
225225
count_authorized = 0
226-
licenses = get_license_names(pkg["licenses"])
227-
for license in licenses:
226+
for license in pkg["licenses"]:
227+
lower = license.lower()
228228
if check_one(
229-
license,
229+
lower,
230230
license_rule="UNAUTHORIZED",
231231
as_regex=as_regex,
232232
):
233233
at_least_one_unauthorized = True
234234
if check_one(
235-
license,
235+
lower,
236236
license_rule="AUTHORIZED",
237237
as_regex=as_regex,
238238
):
@@ -247,7 +247,7 @@ def check_one(license_str, license_rule="AUTHORIZED", as_regex=False):
247247
)
248248
or (
249249
count_authorized
250-
and count_authorized == len(licenses)
250+
and count_authorized == len(pkg["licenses"])
251251
and level is Level.PARANOID
252252
)
253253
):
@@ -259,14 +259,6 @@ def check_one(license_str, license_rule="AUTHORIZED", as_regex=False):
259259

260260
return Reason.UNKNOWN
261261

262-
def get_license_names(licenses):
263-
names = []
264-
for license in licenses:
265-
license = license.lower()
266-
options = license.split(" or ")
267-
for option in options:
268-
names.append(option)
269-
return names
270262

271263
def find_parents(package, all, seen):
272264
if package in seen:

test-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ pytest-cov
33
python-openid;python_version<="2.7"
44
python3-openid;python_version>="3.0"
55
pytest-mock>=1.10
6-
tox

tests/test_check_package.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ def packages():
2525
"version": "1",
2626
"licenses": ["authorized 1", "unauthorized 1"],
2727
},
28-
{
29-
"name": "auth_one_or_unauth_one",
30-
"version": "2",
31-
"licenses": ["authorized 1 or unauthorized 1"],
32-
},
3328
{
3429
"name": "unauth_one",
3530
"version": "2",
@@ -82,9 +77,9 @@ def packages():
8277
@pytest.mark.parametrize(
8378
("level", "reasons"),
8479
[
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]),
82+
(Level.PARANOID, [OK, OK, UNAUTH, UNAUTH, OK, UNAUTH, UNKNOWN, UNKNOWN]),
8883
],
8984
ids=[level.name for level in Level],
9085
)

0 commit comments

Comments
 (0)