MCPcopy Index your code
hub / github.com/StackStorm/st2 / st2_component_python_distribution

Function st2_component_python_distribution

pants-plugins/macros.py:74–112  ·  view source on GitHub ↗

Create a python_distribution (wheel/sdist) for a core StackStorm component.

(**kwargs)

Source from the content-addressed store, hash-verified

72
73
74def st2_component_python_distribution(**kwargs):
75 """Create a python_distribution (wheel/sdist) for a core StackStorm component."""
76 st2_component = kwargs.pop("component_name")
77 description = (
78 f"{st2_component} StackStorm event-driven automation platform component"
79 )
80 # setup(scripts=[...]) is for pre-made scripts, which we have.
81 # TODO: use entry_points.console_scripts instead of hand-generating these.
82 scripts = kwargs.pop("scripts", [])
83
84 st2_license(dest=st2_component)
85
86 kwargs["provides"] = python_artifact( # noqa: F821
87 name=st2_component,
88 description=description,
89 scripts=[
90 script[:-6] if script.endswith(":shell") else script for script in scripts
91 ],
92 version_file=f"{st2_component}/__init__.py", # custom for our release plugin
93 # test_suite=st2_component,
94 zip_safe=False, # We rely on __file__ to load many things, so st2 should not run from a zipapp
95 )
96
97 dependencies = kwargs.pop("dependencies", [])
98 for dep in [st2_component, ":license"] + scripts:
99 dep = f"./{dep}" if dep[0] != ":" else dep
100 if dep not in dependencies:
101 dependencies.append(dep)
102
103 # see st2_shell_sources_and_resources below
104 if dep.endswith(":shell"):
105 dep_res = f"{dep}_resources"
106 if dep_res not in dependencies:
107 dependencies.append(dep_res)
108
109 kwargs["dependencies"] = dependencies
110 kwargs["repositories"] = st2_publish_repos()
111
112 python_distribution(**kwargs) # noqa: F821
113
114
115# Default copied from PEX (which uses zipfile standard MS-DOS epoch).

Callers

nothing calls this directly

Calls 3

st2_licenseFunction · 0.85
st2_publish_reposFunction · 0.85
popMethod · 0.45

Tested by

no test coverage detected