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

[ISSUE-38] Change size computation in getPackageInfoLocal #39

Merged
merged 1 commit into from
Jun 24, 2023
Merged
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
9 changes: 2 additions & 7 deletions licensecheck/packageinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ def getPackageInfoLocal(requirement: str) -> PackageInfo:
author = pkgMetadata.get("Author", UNKNOWN)
name = pkgMetadata.get("Name", UNKNOWN)
version = pkgMetadata.get("Version", UNKNOWN)
size = 0
try:
packagePath = ilr.files(requirement)
size = getModuleSize(cast(Path, packagePath), name)
except TypeError:
pass
size = sum([pp.size for pp in metadata.Distribution.from_name(requirement).files if pp.size is not None])
# append to pkgInfo
return PackageInfo(
name=name,
Expand All @@ -53,7 +48,7 @@ def getPackageInfoLocal(requirement: str) -> PackageInfo:
license=lice,
)

except (metadata.PackageNotFoundError, ModuleNotFoundError) as error:
except metadata.PackageNotFoundError as error:
raise ModuleNotFoundError from error


Expand Down