-
Notifications
You must be signed in to change notification settings - Fork 2
/
.envrc
39 lines (27 loc) · 1.12 KB
/
.envrc
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
#!/usr/bin/env bash
strict_env
direnv_version 2.21
VIRTUAL_ENV="$PWD/.venv"
if ! command -v uv > /dev/null 2>&1; then
echo "uv required, please install manually or run: curl -LsSf https://astral.sh/uv/install.sh | sh"
exit 1
fi
if ! cmp -s "$PWD/requirements.txt" ".venv/requirements.txt"; then
uv venv
uv pip install --upgrade -r "$PWD/requirements.txt"
cp "$PWD/requirements.txt" ".venv/requirements.txt"
fi
export VIRTUAL_ENV
PATH_add "${VIRTUAL_ENV}/bin"
if ! cmp -s "$PWD/galaxy.yml" ".venv/galaxy.yml"; then
collections_dir=$(readlink -f "$(pwd)/../../")
collections_dir_name=$(basename "$collections_dir")
if [ "${collections_dir_name}" != "ansible_collections" ]; then
echo "Not a ansible_collections dir. git repo needs to be cloned in ./ansible_collections/jwnmulder/zyxel_vmg8825. Got: ${collections_dir}"
exit 1
fi
# Set ANSIBLE_COLLECTIONS_PATHS to avoid some warnings
export ANSIBLE_COLLECTIONS_PATH="$collections_dir"
uv run ansible-galaxy collection install --upgrade ansible.netcommon -p "$collections_dir"
cp "$PWD/galaxy.yml" ".venv/galaxy.yml"
fi