2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-06 23:44:03 +00:00

fix: use with to read pyproject.toml

Also fix variable name

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2024-11-25 13:40:27 +05:30
parent af8ed34201
commit f3110e5456
No known key found for this signature in database
GPG Key ID: 9DCC61E211BF645F

View File

@ -114,10 +114,11 @@ def _generate_dev_deps_pattern(pyproject_path):
from tomllib import loads
requirements_pattern = ""
pyroject_config = loads(open(pyproject_path).read())
with open(pyproject_path) as f:
pyproject_config = loads(f.read())
with contextlib.suppress(KeyError):
for pkg, version in pyroject_config["tool"]["bench"]["dev-dependencies"].items():
for pkg, version in pyproject_config["tool"]["bench"]["dev-dependencies"].items():
op = "==" if "=" not in version else ""
requirements_pattern += f"{pkg}{op}{version} "
return requirements_pattern