Skip to content

Commit

Permalink
Make sure user is notified that (gui-)scripts have to be defined in d…
Browse files Browse the repository at this point in the history
…ynamic
  • Loading branch information
abravalheri committed Aug 11, 2023
1 parent ecc1233 commit 237b612
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions setuptools/config/_apply_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,16 @@ def _get_previous_entrypoints(dist: "Distribution") -> Dict[str, list]:
return {k: v for k, v in value.items() if k not in ignore}


def _get_previous_scripts(dist: "Distribution") -> Optional[list]:
value = getattr(dist, "entry_points", None) or {}
return value.get("console_scripts")


def _get_previous_gui_scripts(dist: "Distribution") -> Optional[list]:
value = getattr(dist, "entry_points", None) or {}
return value.get("gui_scripts")


def _attrgetter(attr):
"""
Similar to ``operator.attrgetter`` but returns None if ``attr`` is not found
Expand Down Expand Up @@ -371,6 +381,8 @@ def _acessor(obj):
"classifiers": _attrgetter("metadata.classifiers"),
"urls": _attrgetter("metadata.project_urls"),
"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"),
}
Expand Down

0 comments on commit 237b612

Please sign in to comment.