2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-22 22:58:31 +00:00

fix: use optional-dependencies as preferred variant to custom dev-dependencies

This commit is contained in:
David 2024-10-26 18:58:59 +02:00
parent af8ed34201
commit dc0768819b
No known key found for this signature in database
GPG Key ID: AB15A6AF1101390D

View File

@ -97,8 +97,15 @@ def install_python_dev_dependencies(bench_path=".", apps=None, verbose=False):
dev_requirements_path = os.path.join(app_path, "dev-requirements.txt")
if os.path.exists(pyproject_path):
pyproject_deps = _generate_dev_deps_pattern(pyproject_path)
if pyproject_deps:
try:
from tomli import loads
except ImportError:
from tomllib import loads
pyroject_config = loads(open(pyproject_path).read())
for key, deps in pyroject_config["project"]["optional-dependencies"].items():
bench.run(f"{bench.python} -m pip install {quiet_flag} --upgrade {' '.join(deps)}")
if pyproject_deps := _generate_dev_deps_pattern(pyproject_path):
bench.run(f"{bench.python} -m pip install {quiet_flag} --upgrade {pyproject_deps}")
if not pyproject_deps and os.path.exists(dev_requirements_path):