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 Aug 23, 2023
1 parent 1846940 commit 619cb1f
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 @@ -216,7 +216,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 @@ -383,8 +383,8 @@ def _acessor(obj):
"entry-points": _get_previous_entrypoints,
"scripts": _get_previous_scripts,
"gui-scripts": _get_previous_gui_scripts,
"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 @@ -388,12 +388,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", [("scripts", "console_scripts"), ("gui-scripts", "gui_scripts")]
Expand Down

0 comments on commit 619cb1f

Please sign in to comment.