-
Notifications
You must be signed in to change notification settings - Fork 289
/
Copy pathinit-user.sh
executable file
·34 lines (25 loc) · 1 KB
/
init-user.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
#!/usr/bin/env bash
# Install all dependencies that the project needs to run.
set -e
cd "$(dirname "$0")/.."
# Ensure that packages are only installed in an active virtual environment
export PIP_REQUIRE_VIRTUALENV=true
if [ -f "Pipfile" ] && [ -n "$(pipenv --version 2>/dev/null)" ]; then
echo "==> Initializing pipenv environment and installing packages..."
pipenv install
elif [ -f "requirements.txt" ]; then
if [ -n "$(python -c 'import sys; print (sys.real_prefix)' 2>/dev/null)" ]; then
echo "==> Installing requirements.txt packages in the active virtual environment..."
else
if [ ! -d "venv" ]; then
echo "==> Creating a new virtual environment 'venv' for the project..."
python -m venv venv
else
echo "==> Installing requirements.txt packages in the project's 'venv' virtual environment..."
source venv/bin/activate
fi
fi
pip install -r requirements.txt
else
echo "No Python requirements found."
fi