Skip to content

Commit 2ef8586

Browse files
committed
rel 2023.1.2
1 parent f166187 commit 2ef8586

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All major and minor version changes will be documented in this file. Details of
44
patch-level version changes can be found in [commit messages](../../commits/master).
55

6+
## 2023.1.2 - 2023/06/24
7+
8+
- Merge PR https://github.com/FHPythonUtils/LicenseCheck/pull/39 (Fixes #38)
9+
610
## 2023.1.1 - 2023/03/07
711

812
- Merge PR https://github.com/FHPythonUtils/LicenseCheck/pull/33

documentation/reference/licensecheck/packageinfo.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Packageinfo
1717

1818
## getModuleSize
1919

20-
[Show source in packageinfo.py:168](../../../licensecheck/packageinfo.py#L168)
20+
[Show source in packageinfo.py:161](../../../licensecheck/packageinfo.py#L161)
2121

2222
Get the size of a given module as an int.
2323

@@ -41,7 +41,7 @@ def getModuleSize(path: Path, name: str) -> int:
4141

4242
## getMyPackageLicense
4343

44-
[Show source in packageinfo.py:151](../../../licensecheck/packageinfo.py#L151)
44+
[Show source in packageinfo.py:144](../../../licensecheck/packageinfo.py#L144)
4545

4646
Get the package license from "setup.cfg", "pyproject.toml" or user input
4747

@@ -60,7 +60,7 @@ def getMyPackageLicense() -> str:
6060

6161
## getMyPackageMetadata
6262

63-
[Show source in packageinfo.py:127](../../../licensecheck/packageinfo.py#L127)
63+
[Show source in packageinfo.py:120](../../../licensecheck/packageinfo.py#L120)
6464

6565
Get the package classifiers and license from "setup.cfg", "pyproject.toml"
6666

@@ -79,7 +79,7 @@ def getMyPackageMetadata() -> dict[str, Any]:
7979

8080
## getPackageInfoLocal
8181

82-
[Show source in packageinfo.py:22](../../../licensecheck/packageinfo.py#L22)
82+
[Show source in packageinfo.py:16](../../../licensecheck/packageinfo.py#L16)
8383

8484
Get package info from local files including version, author
8585
and the license.
@@ -112,7 +112,7 @@ def getPackageInfoLocal(requirement: str) -> PackageInfo:
112112

113113
## getPackageInfoPypi
114114

115-
[Show source in packageinfo.py:60](../../../licensecheck/packageinfo.py#L60)
115+
[Show source in packageinfo.py:53](../../../licensecheck/packageinfo.py#L53)
116116

117117
Get package info from local files including version, author
118118
and the license.
@@ -145,7 +145,7 @@ def getPackageInfoPypi(requirement: str) -> PackageInfo:
145145

146146
## getPackages
147147

148-
[Show source in packageinfo.py:105](../../../licensecheck/packageinfo.py#L105)
148+
[Show source in packageinfo.py:98](../../../licensecheck/packageinfo.py#L98)
149149

150150
Get dependency info.
151151

@@ -172,7 +172,7 @@ def getPackages(reqs: set[str]) -> set[PackageInfo]:
172172

173173
## licenseFromClassifierlist
174174

175-
[Show source in packageinfo.py:85](../../../licensecheck/packageinfo.py#L85)
175+
[Show source in packageinfo.py:78](../../../licensecheck/packageinfo.py#L78)
176176

177177
Get license string from a list of project classifiers.
178178

licensecheck/packageinfo.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,9 @@
33
from __future__ import annotations
44

55
import configparser
6-
import sys
76
from importlib import metadata
8-
9-
if sys.version_info < (3, 9, 0):
10-
import importlib_resources as ilr
11-
else:
12-
import importlib.resources as ilr
137
from pathlib import Path
14-
from typing import Any, cast
8+
from typing import Any
159

1610
import requests
1711
import tomli
@@ -37,7 +31,11 @@ def getPackageInfoLocal(requirement: str) -> PackageInfo:
3731
author = pkgMetadata.get("Author", UNKNOWN)
3832
name = pkgMetadata.get("Name", UNKNOWN)
3933
version = pkgMetadata.get("Version", UNKNOWN)
40-
size = sum([pp.size for pp in metadata.Distribution.from_name(requirement).files if pp.size is not None])
34+
size = 0
35+
packagePaths = metadata.Distribution.from_name(requirement).files
36+
if packagePaths is not None:
37+
size = sum(pp.size for pp in packagePaths if pp.size is not None)
38+
4139
# append to pkgInfo
4240
return PackageInfo(
4341
name=name,

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "licensecheck"
3-
version = "2023.1.1"
3+
version = "2023.1.2"
44
license = "mit"
55
description = "Output the licenses used by dependencies and check if these are compatible with the project license"
66
authors = ["FredHappyface"]
@@ -33,7 +33,6 @@ requests = "<3,>=2.28.1"
3333
fhconfparser = "<2024,>=2022"
3434
tomli = "<3,>=2.0.1"
3535
rich = "<13,>=12.6.0"
36-
importlib-resources = { version = ">=3.0.0", python = "<3.9" }
3736

3837
[tool.poetry.dev-dependencies]
3938
pytest = "^7.1.1"

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
fhconfparser<2024,>=2022
2-
importlib-resources>=3.0.0;python_version<'3.9'
32
requests<3,>=2.28.1
43
requirements-parser<2,>=0.5.0
54
rich<13,>=12.6.0

0 commit comments

Comments
 (0)