2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-08 00:04:38 +00:00

Merge pull request #1597 from akhilnarang/fix-pyproject-open

fix: use `with` to read pyproject.toml
This commit is contained in:
Akhil Narang 2024-11-25 13:54:12 +05:30 committed by GitHub
commit aae99fa10e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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