-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinstall.py
More file actions
executable file
·31 lines (23 loc) · 1001 Bytes
/
install.py
File metadata and controls
executable file
·31 lines (23 loc) · 1001 Bytes
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
#!/usr/bin/env python3
import argparse
import os
import subprocess
parser = argparse.ArgumentParser(description="Install FK and dependencies.")
parser.add_argument('--venv', metavar='DIR', type=str, default="python-venv", help='destination of local Python virtual environment')
args = parser.parse_args()
def execute(cmd):
ret = subprocess.run(
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True
)
if ret.returncode:
raise RuntimeError(
"Running {} failed!\n Output: {}".format(cmd, ret.stdout.decode("utf-8"))
)
return ret.stdout.decode("utf-8")
python_env_dir = args.venv
print("Creating Python virtualenv at {}".format(python_env_dir))
execute("python3 -mvenv {}".format(python_env_dir))
print("Install Python dependencies with pip")
execute(". {}/bin/activate && pip3 install -r requirements.txt".format(python_env_dir))
print("Configure mypy extensions")
execute(". {}/bin/activate && mypy_boto3".format(python_env_dir))