File: make.sh

package info (click to toggle)
libappimage 1.0.4-5-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,360 kB
  • sloc: cpp: 4,678; ansic: 1,325; sh: 170; python: 27; makefile: 19
file content (27 lines) | stat: -rwxr-xr-x 831 bytes parent folder | download | duplicates (3)
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 -e

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)
    PYTHON=python3
    which python3.6 &>/dev/null && PYTHON=python3.6
    "$PYTHON" -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)
    cp requirements.txt "$VENV"/requirements.txt
    pip install -U -r "$VENV"/requirements.txt
fi

make "$@"