-
-
Notifications
You must be signed in to change notification settings - Fork 751
/
Copy pathBUILD.venv
73 lines (67 loc) · 2.57 KB
/
BUILD.venv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# rules on what packaging can depend on
__dependencies_rules__(
(
# All python sources in this directory
"<python_*>[/*]",
(
# may depend on 3rd party dependencies,
"//reqs#*",
# and on anything in this diretory,
"/**",
# but nothing else (eg not st2common, st2*, runners, ...).
"!*",
),
),
# other targets (not python in this directory) may depend on anything.
("*", "*"),
)
python_sources()
# We use st2-py*.pex to quickly build a venv (like /opt/stackstorm/st2)
# that includes all requirements and our wheels.
def _pex_py3(minor: str, constraint: str = ""):
if not constraint:
constraint = f"CPython==3.{minor}.*"
return parametrize(
f"py3{minor}",
output_path=f"${{spec_path_normalized}}/st2-py3{minor}.pex",
interpreter_constraints=[constraint],
)
pex_binary(
name="st2.pex",
dependencies=[
# this should depend on all python_distribution targets
"//st2actions",
"//st2api",
"//st2auth",
"//st2client",
"//st2common",
"//st2reactor",
"//st2stream",
"//st2tests",
"//contrib/runners/action_chain_runner",
"//contrib/runners/announcement_runner",
"//contrib/runners/http_runner",
"//contrib/runners/inquirer_runner",
"//contrib/runners/local_runner",
"//contrib/runners/noop_runner",
"//contrib/runners/orquesta_runner",
"//contrib/runners/python_runner",
"//contrib/runners/remote_runner",
"//contrib/runners/winrm_runner",
],
executable="build_st2_venv.py", # included by dependency inferrence
execution_mode="venv",
layout="zipapp", # zipapp creates a single file, loose and packed create directories
sh_boot=True, # faster startup time (only relevant for unpacking the pex)
include_tools=True, # include pex.tools to populate a venv from the pex
# TODO: To improve docker layer caching, we could break this into 2 pexes
# one w/ include_requirements=False and the other w/ include_requirements=True.
include_requirements=True, # include third party requirements
include_sources=False, # already includes our wheels, skipping wheel-owned sources
venv_hermetic_scripts=False, # do not add -sE to script shebangs
# 1 parametrize group per python minor version in [DEFAULT].st2_interpreter_constraints in pants.toml
**_pex_py3("8", constraint="CPython>=3.8.1,<3.9"),
**_pex_py3("9"),
**_pex_py3("10"),
**_pex_py3("11"),
)