Skip to content

Commit 130ad3c

Browse files
committed
2 parents f6d5a58 + 54679ac commit 130ad3c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

licensecheck/get_deps.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from pathlib import Path
77
from typing import Any
88

9+
import requirements
910
import pkg_resources
1011
import tomli
1112

@@ -97,8 +98,9 @@ def _doGetReqs(
9798
if not reqPath.exists():
9899
raise RuntimeError(f"Could not find specification of requirements ({reqPath}).")
99100

100-
for req in reqPath.read_text("utf-8").strip().split("\n"):
101-
reqs.add(resolveReq(req))
101+
with open(reqPath, encoding="utf-8") as requirementsTxt:
102+
for req in requirements.parse(requirementsTxt):
103+
reqs.add(str(req.name).lower())
102104

103105
try:
104106
reqs.remove("PYTHON")

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ licensecheck = 'licensecheck:cli'
2828

2929
[tool.poetry.dependencies]
3030
python = "^3.8"
31+
requirements-parser = "<2,>=0.5.0"
3132
requests = "<3,>=2.31.0"
3233
fhconfparser = "<2024,>=2022"
3334
tomli = "<3,>=2.0.1"

0 commit comments

Comments
 (0)