From 207980550493b587c964001636c59125e69f72da Mon Sep 17 00:00:00 2001 From: Kamil Raczycki Date: Fri, 20 Jan 2023 23:21:05 +0100 Subject: [PATCH 1/2] fix: properly parse packages without classifiers --- licensecheck/packageinfo.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/licensecheck/packageinfo.py b/licensecheck/packageinfo.py index 96f7b19..355ec12 100644 --- a/licensecheck/packageinfo.py +++ b/licensecheck/packageinfo.py @@ -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"): From eff6baf46048930ae77d85cad516ce8fc95d779b Mon Sep 17 00:00:00 2001 From: Kamil Raczycki Date: Sat, 21 Jan 2023 00:04:16 +0100 Subject: [PATCH 2/2] fix: properly parse packages interpreted as a MultiplexedPath --- licensecheck/packageinfo.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/licensecheck/packageinfo.py b/licensecheck/packageinfo.py index 355ec12..2449592 100644 --- a/licensecheck/packageinfo.py +++ b/licensecheck/packageinfo.py @@ -175,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)