forked from AppImage/docs.appimage.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.sh
executable file
·27 lines (18 loc) · 843 Bytes
/
make.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
#! /bin/bash
set -eo pipefail
CUR_DIR="$(readlink -f "$(dirname "$0")")"
cd "$CUR_DIR"
VENV="$CUR_DIR"/.venv
if [ ! -d "$VENV" ] || [ ! -e "$VENV"/bin/activate ]; then
echo "$(tput bold)$(tput setaf 2)Creating new virtual environment in $VENV$(tput sgr0)"
python3 -m venv "$VENV"
fi
source "$VENV"/bin/activate
# this snippet should allow us to call pip install only if the requirements file has been touched
if [ ! -f "$VENV"/requirements.txt ] || [ "$(sha256sum requirements.txt | cut -d' ' -f1)" != "$(sha256sum "$VENV"/requirements.txt | cut -d' ' -f1)" ]; then
echo "$(tput bold)$(tput setaf 2)Requirements updated, reinstalling$(tput sgr0)"
pip install -U -r requirements.txt
# we want to make sure the installation works before copying the file
cp requirements.txt "$VENV"/requirements.txt
fi
make "$@"