forked from IntersectMBO/cardano-node-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_dev_venv.sh
executable file
·53 lines (42 loc) · 1.24 KB
/
setup_dev_venv.sh
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
#!/bin/sh
#
# Install cardano_node_tests and its dependencies into a virtual environment.
PYTHON_VERSION="3.10"
abort_install=0
set -eu
if [ -n "${IN_NIX_SHELL:-""}" ]; then
echo "This script is not supposed to run inside nix shell." >&2
abort_install=1
fi
if ! command -v poetry >/dev/null 2>&1; then
echo "Poetry is not installed. Please install it first." >&2
abort_install=1
fi
if [ ! -d "cardano_node_tests" ]; then
echo "This script is supposed to run from the root of cardano-node-tests directory." >&2
abort_install=1
fi
if [ -n "${VIRTUAL_ENV:-""}" ]; then
if [ "$abort_install" -eq 1 ]; then
exit 1
fi
echo "A python virtual env is already activated in this shell."
echo "Install into the current virtual env? [y/N]"
read -r answer
if [ "$answer" != "y" ]; then
exit 1
fi
poetry install --with docs --with dev
exit 0
fi
# use the same python version as in nix shell
if ! command -v "python$PYTHON_VERSION" >/dev/null 2>&1; then
echo "Python $PYTHON_VERSION is not installed. Please install it first." >&2
abort_install=1
fi
if [ "$abort_install" -eq 1 ]; then
exit 1
fi
poetry env use "python$PYTHON_VERSION"
poetry install --with docs --with dev
echo "Run \`poetry shell\` to activate the virtual env."