Skip to content

Commit

Permalink
Prevent install_requires and extras_require to not be set in dist
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Sep 8, 2023
1 parent d25d03c commit c16a547
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 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)
else:
if hasattr(dist, field):
setattr(dist, field, value)


Expand Down
13 changes: 5 additions & 8 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,11 @@ def __init__(self, attrs=None):
self.setup_requires = attrs.pop('setup_requires', [])
for ep in metadata.entry_points(group='distutils.setup_keywords'):
vars(self).setdefault(ep.name, None)
_Distribution.__init__(
self,
{
k: v
for k, v in attrs.items()
if k not in self._DISTUTILS_UNSUPPORTED_METADATA
},
)

metadata_only = set(self._DISTUTILS_UNSUPPORTED_METADATA)
metadata_only -= {"install_requires", "extras_require"}
dist_attrs = {k: v for k, v in attrs.items() if k not in metadata_only}
_Distribution.__init__(self, dist_attrs)

# Private API (setuptools-use only, not restricted to Distribution)
# Stores files that are referenced by the configuration and need to be in the
Expand Down

0 comments on commit c16a547

Please sign in to comment.