Skip to content

Commit

Permalink
Set requirements attributes directly into dist when parsing pyproject…
Browse files Browse the repository at this point in the history
….toml
  • Loading branch information
abravalheri committed Sep 12, 2023
1 parent 566f294 commit 7b7971e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions setuptools/config/_apply_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _set_config(dist: "Distribution", field: str, value: Any):
setter(value)
elif hasattr(dist.metadata, field) or field in SETUPTOOLS_PATCHES:
setattr(dist.metadata, field, value)
if hasattr(dist, field):
else:
setattr(dist, field, value)


Expand Down Expand Up @@ -212,12 +212,12 @@ def _dependencies(dist: "Distribution", val: list, _root_dir):
if getattr(dist, "install_requires", []):
msg = "`install_requires` overwritten in `pyproject.toml` (dependencies)"
SetuptoolsWarning.emit(msg)
_set_config(dist, "install_requires", val)
dist.install_requires = val


def _optional_dependencies(dist: "Distribution", val: dict, _root_dir):
existing = getattr(dist, "extras_require", None) or {}
_set_config(dist, "extras_require", {**existing, **val})
dist.extras_require = {**existing, **val}


def _unify_entry_points(project_table: dict):
Expand Down

0 comments on commit 7b7971e

Please sign in to comment.