13
13
# limitations under the License.
14
14
15
15
16
+ def st2_license (** kwargs ):
17
+ """copy the LICENSE file into each wheel.
18
+
19
+ As long as the file is in the src root when building the sdist/wheel,
20
+ setuptools automatically includes the LICENSE file in the dist-info.
21
+ """
22
+ if "dest" not in kwargs :
23
+ raise ValueError ("'dest' path is required for st2_license macro" )
24
+ relocated_files ( # noqa: F821
25
+ name = "license" ,
26
+ files_targets = ["//:license" ],
27
+ src = "" ,
28
+ ** kwargs ,
29
+ )
30
+
31
+
16
32
def st2_runner_python_distribution (** kwargs ):
17
33
runner_name = kwargs .pop ("runner_name" )
18
34
description = kwargs .pop ("description" )
19
35
36
+ st2_license (dest = f"contrib/runners/{ runner_name } _runner" )
37
+
20
38
kwargs ["provides" ] = python_artifact ( # noqa: F821
21
39
name = f"stackstorm-runner-{ runner_name .replace ('_' , '-' )} " ,
22
40
description = description ,
@@ -28,7 +46,7 @@ def st2_runner_python_distribution(**kwargs):
28
46
)
29
47
30
48
dependencies = kwargs .pop ("dependencies" , [])
31
- for dep in [f"./{ runner_name } _runner" ]:
49
+ for dep in [f"./{ runner_name } _runner" , ":license" ]:
32
50
if dep not in dependencies :
33
51
dependencies .append (dep )
34
52
kwargs ["dependencies" ] = dependencies
@@ -45,6 +63,8 @@ def st2_runner_python_distribution(**kwargs):
45
63
def st2_component_python_distribution (** kwargs ):
46
64
st2_component = kwargs .pop ("component_name" )
47
65
66
+ st2_license (dest = st2_component )
67
+
48
68
description = (
49
69
f"{ st2_component } StackStorm event-driven automation platform component"
50
70
)
@@ -64,7 +84,7 @@ def st2_component_python_distribution(**kwargs):
64
84
65
85
dependencies = kwargs .pop ("dependencies" , [])
66
86
67
- for dep in [st2_component ] + scripts :
87
+ for dep in [st2_component , ":license" ] + scripts :
68
88
dep = f"./{ dep } " if dep [0 ] != ":" else dep
69
89
if dep not in dependencies :
70
90
dependencies .append (dep )
0 commit comments