forked from imbus/robotframework-tutorial-de
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.py
26 lines (22 loc) · 877 Bytes
/
bootstrap.py
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
import platform
import subprocess
from pathlib import Path
from venv import EnvBuilder
venv_dir = Path(".") / ".venv"
if not platform.platform().startswith("Windows"):
venv_python = venv_dir / "bin" / "python"
else:
venv_python = venv_dir / "Scripts" / "python.exe"
if not venv_dir.exists():
print(f"Creating virtualenv in {venv_dir}")
EnvBuilder(with_pip=True).create(venv_dir)
subprocess.run([venv_python, "-m", "pip", "install", "-U", "pip"])
subprocess.run([venv_python, "-m", "pip", "install", "-U", "-r", "requirements.txt"])
subprocess.run([venv_python, "-m", "Browser.entry", "init"])
activate_script = (
"source .venv/bin/activate"
if not platform.platform().startswith("Windows")
else ".venv\\Scripts\\activate"
)
print(f"Virtualenv `{venv_dir}` is ready and up-to-date.")
print(f"Run `{activate_script}` to activate the virtualenv.")