Skip to content

Commit

Permalink
Minor adjustments in apply_pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Apr 24, 2023
1 parent cb74c80 commit d45557c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions setuptools/config/_apply_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _dependencies(dist: "Distribution", val: list, _root_dir):


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


Expand Down Expand Up @@ -353,8 +353,8 @@ def _acessor(obj):
"classifiers": _attrgetter("metadata.classifiers"),
"urls": _attrgetter("metadata.project_urls"),
"entry-points": _get_previous_entrypoints,
"dependencies": _some_attrgetter("_orig_install_requires", "install_requires"),
"optional-dependencies": _some_attrgetter("_orig_extras_require", "extras_require"),
"dependencies": _attrgetter("install_requires"),
"optional-dependencies": _attrgetter("extras_require"),
}


Expand Down
2 changes: 1 addition & 1 deletion setuptools/tests/config/test_apply_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,12 @@ def test_optional_dependencies_dont_remove_env_markers(self, tmp_path):
dist = makedist(tmp_path, install_requires=install_req)
dist = pyprojecttoml.apply_configuration(dist, pyproject)
assert "foo" in dist.extras_require
assert ':python_version < "3.7"' in dist.extras_require
egg_info = dist.get_command_obj("egg_info")
write_requirements(egg_info, tmp_path, tmp_path / "requires.txt")
reqs = (tmp_path / "requires.txt").read_text(encoding="utf-8")
assert "importlib-resources" in reqs
assert "bar" in reqs
assert ':python_version < "3.7"' in reqs

@pytest.mark.parametrize(
"field,group",
Expand Down

0 comments on commit d45557c

Please sign in to comment.