diff --git a/grayskull/strategy/py_toml.py b/grayskull/strategy/py_toml.py index d4ff4aca..6a2ebb34 100644 --- a/grayskull/strategy/py_toml.py +++ b/grayskull/strategy/py_toml.py @@ -204,6 +204,12 @@ def add_poetry_metadata(metadata: dict, toml_metadata: dict) -> dict: metadata["requirements"]["run_constrained"].extend(req_run_constrained) host_metadata = metadata["requirements"].get("host", []) + if toml_metadata["tool"].get("poetry", {}).get("scripts"): + metadata["build"]["entry_points"] = [] + for entry_name, entry_path in toml_metadata["tool"]["poetry"][ + "scripts" + ].items(): + metadata["build"]["entry_points"].append(f"{entry_name} = {entry_path}") if "poetry" not in host_metadata and "poetry-core" not in host_metadata: metadata["requirements"]["host"] = host_metadata + ["poetry-core"] diff --git a/tests/test_poetry.py b/tests/test_poetry.py index 47cf0620..24227ff4 100644 --- a/tests/test_poetry.py +++ b/tests/test_poetry.py @@ -167,3 +167,34 @@ def test_get_constrained_dep_version_not_present(): ) == "pytest-kind" ) + + +def test_entrypoints(): + poetry = { + "requirements": {"host": ["setuptools"], "run": ["python"]}, + "build": {}, + "test": {}, + } + toml_metadata = { + "tool": { + "poetry": { + "scripts": { + "grayskull": "grayskull.main:main", + "grayskull-recipe": "grayskull.main:recipe", + } + } + } + } + assert add_poetry_metadata(poetry, toml_metadata) == { + "requirements": { + "host": ["setuptools", "poetry-core"], + "run": ["python"], + }, + "build": { + "entry_points": [ + "grayskull = grayskull.main:main", + "grayskull-recipe = grayskull.main:recipe", + ] + }, + "test": {}, + }