forked from MarketSquare/AssertionEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.py
33 lines (27 loc) · 994 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
32
33
"""Creates a virtual environment for developing the library.
Also installs the minimum set of dependencies to run invoke.
Copied from: https://github.com/MarketSquare/robotframework-browser/blob/master/bootstrap.py
"""
import platform
import subprocess
from pathlib import Path
from venv import EnvBuilder
venv_dir = Path(".") / ".venv"
if platform.platform().startswith("Windows"):
venv_python = venv_dir / "Scripts" / "python.exe"
else:
venv_python = venv_dir / "bin" / "python"
src_dir = Path(".") / "AssertionEngine"
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", "invoke",]
)
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.")