diff --git a/grayskull/pypi/pypi.py b/grayskull/pypi/pypi.py index c16d247c2..4e4a1d852 100644 --- a/grayskull/pypi/pypi.py +++ b/grayskull/pypi/pypi.py @@ -413,15 +413,24 @@ def _get_entry_points_from_sdist(sdist_metadata: dict) -> List: :param sdist_metadata: sdist metadata :return: list with all entry points """ - all_entry_points = sdist_metadata.get("entry_points", None) + all_entry_points = sdist_metadata.get("entry_points", {}) if isinstance(all_entry_points, str) or not all_entry_points: return [] if all_entry_points.get("console_scripts") or all_entry_points.get( "gui_scripts" ): - return all_entry_points.get("console_scripts", []) + all_entry_points.get( - "gui_scripts", [] - ) + console_scripts = all_entry_points.get("console_scripts", []) + gui_scripts = all_entry_points.get("gui_scripts", []) + entry_points_result = [] + if console_scripts: + if isinstance(console_scripts, str): + console_scripts = [console_scripts] + entry_points_result += console_scripts + if gui_scripts: + if isinstance(gui_scripts, str): + gui_scripts = [gui_scripts] + entry_points_result += gui_scripts + return entry_points_result return [] @staticmethod diff --git a/tests/test_pypi.py b/tests/test_pypi.py index 1b46d9f45..5fe81cab0 100644 --- a/tests/test_pypi.py +++ b/tests/test_pypi.py @@ -260,6 +260,26 @@ def test_get_entry_points_from_sdist(): } ) ) == sorted(["gui_scripts=entrypoints", "console_scripts=entrypoints"]) + assert sorted( + PyPi._get_entry_points_from_sdist( + { + "entry_points": { + "gui_scripts": None, + "console_scripts": "console_scripts=entrypoints", + } + } + ) + ) == sorted(["console_scripts=entrypoints"]) + assert sorted( + PyPi._get_entry_points_from_sdist( + { + "entry_points": { + "gui_scripts": "gui_scripts=entrypoints", + "console_scripts": None, + } + } + ) + ) == sorted(["gui_scripts=entrypoints"]) def test_build_noarch_skip():