forked from MarketSquare/robotframework-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.py
31 lines (26 loc) · 909 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
27
28
29
30
31
"""Creates a virtual environment for developing the library.
Also installs the needed dependencies.
"""
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"
src_dir = Path(".") / "Browser"
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", "-r", str(src_dir / "dev-requirements.txt"),]
)
activate_script = (
"source .venv/bin/activate"
if not platform.platform().startswith("Windows")
else ".venv\Scripts\\activate.bat"
)
print(f"Virtualenv `{venv_dir}` is ready and up-to-date.")
print(f"Run `{activate_script}` to activate the virtualenv.")