forked from temporalio/sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_release_package.py
More file actions
54 lines (42 loc) · 1.46 KB
/
Copy pathinstall_release_package.py
File metadata and controls
54 lines (42 loc) · 1.46 KB
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
"""Install a release package for smoke testing."""
from __future__ import annotations
import argparse
import importlib.metadata
import subprocess
import sys
from collections.abc import Sequence
def _pip_install(args: Sequence[str]) -> None:
subprocess.check_call([sys.executable, "-m", "pip", "install", *args])
def install_package(args: argparse.Namespace) -> None:
package = f"temporalio=={args.version}"
if args.dependency_index_url:
_pip_install(
[
"--prefer-binary",
"--index-url",
args.index_url,
"--no-deps",
package,
]
)
requirements = importlib.metadata.requires("temporalio") or []
if requirements:
_pip_install(
[
"--prefer-binary",
"--index-url",
args.dependency_index_url,
*requirements,
]
)
else:
_pip_install(["--prefer-binary", "--index-url", args.index_url, package])
subprocess.check_call([sys.executable, "-m", "pip", "check"])
def main(argv: Sequence[str] | None = None) -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--version", required=True)
parser.add_argument("--index-url", required=True)
parser.add_argument("--dependency-index-url")
install_package(parser.parse_args(argv))
if __name__ == "__main__":
main()