def st2_component_python_distribution(**kwargs):
    """Create a python_distribution (wheel/sdist) for a core StackStorm component."""
    st2_component = kwargs.pop("component_name")
    description = (
        f"{st2_component} StackStorm event-driven automation platform component"
    )
    # setup(scripts=[...]) is for pre-made scripts, which we have.
    # TODO: use entry_points.console_scripts instead of hand-generating these.
    scripts = kwargs.pop("scripts", [])

    st2_license(dest=st2_component)

    kwargs["provides"] = python_artifact(  # noqa: F821
        name=st2_component,
        description=description,
        scripts=[
            script[:-6] if script.endswith(":shell") else script for script in scripts
        ],
        version_file=f"{st2_component}/__init__.py",  # custom for our release plugin
        # test_suite=st2_component,
        zip_safe=False,  # We rely on __file__ to load many things, so st2 should not run from a zipapp
    )

    dependencies = kwargs.pop("dependencies", [])
    for dep in [st2_component, ":license"] + scripts:
        dep = f"./{dep}" if dep[0] != ":" else dep
        if dep not in dependencies:
            dependencies.append(dep)

        # see st2_shell_sources_and_resources below
        if dep.endswith(":shell"):
            dep_res = f"{dep}_resources"
            if dep_res not in dependencies:
                dependencies.append(dep_res)

    kwargs["dependencies"] = dependencies
    kwargs["repositories"] = st2_publish_repos()

    python_distribution(**kwargs)  # noqa: F821
Create a python_distribution (wheel/sdist) for a core StackStorm component.
pants-plugins/macros.py