Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Support for unix pattern in packages #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions licensecheck/get_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from fnmatch import fnmatchcase
from pathlib import Path

import tomli
Expand Down Expand Up @@ -120,17 +121,20 @@ def getDepsWithLicenses(
# Deal with --ignore-packages and --fail-packages
package.licenseCompat = False
packageName = package.name.upper()
if packageName in ignorePackages:
package.licenseCompat = True
elif packageName in failPackages:
pass # package.licenseCompat = False
# Else get compat with myLice
for ignoredPattern in ignorePackages:
if fnmatchcase(packageName, ignoredPattern):
package.licenseCompat = True
break
else:
package.licenseCompat = license_matrix.depCompatWMyLice(
myLice,
license_matrix.licenseType(package.license, ignoreLicenses),
ignoreLicensesType,
failLicensesType,
onlyLicensesType,
)
if packageName in failPackages:
pass # package.licenseCompat = False
# Else get compat with myLice
else:
package.licenseCompat = license_matrix.depCompatWMyLice(
myLice,
license_matrix.licenseType(package.license, ignoreLicenses),
ignoreLicensesType,
failLicensesType,
onlyLicensesType,
)
return packages