Skip to content

Commit

Permalink
Merge pull request #29 from RaczeQ/master
Browse files Browse the repository at this point in the history
fix: properly parse packages without pypi classifiers
  • Loading branch information
FredHappyface authored Jan 23, 2023
2 parents 5bbbb11 + eff6baf commit ac899c7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions licensecheck/packageinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def licenseFromClassifierlist(classifiers: list[str]) -> str:
Returns:
str: the license name
"""
if not classifiers:
return UNKNOWN
licenses = []
for val in classifiers:
if val.startswith("License"):
Expand Down Expand Up @@ -173,9 +175,15 @@ def getModuleSize(path: Path, name: str) -> int:
Returns:
int: size in bytes
"""
size = sum(
f.stat().st_size for f in path.glob("**/*") if f.is_file() and "__pycache__" not in str(f)
)
size = 0
try:
size = sum(
f.stat().st_size
for f in path.glob("**/*")
if f.is_file() and "__pycache__" not in str(f)
)
except AttributeError:
pass
if size > 0:
return size
request = requests.get(f"https://pypi.org/pypi/{name}/json", timeout=60)
Expand Down

0 comments on commit ac899c7

Please sign in to comment.