35 lines
708 B
Bash
35 lines
708 B
Bash
#!/usr/bin/env bash
|
|
|
|
show_help() {
|
|
echo "Init venv
|
|
A script to initialize the python virtual environment used for development.
|
|
|
|
Usage: init_venv.sh [OPTIONS]
|
|
|
|
Options:
|
|
-h|--help: Shows this help message.
|
|
"
|
|
}
|
|
|
|
while [[ "$#" -gt 0 ]]; do
|
|
case "$1" in
|
|
-h|--help)
|
|
show_help
|
|
exit
|
|
;;
|
|
*)
|
|
echo "Invalid argument given ($1)"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
cur_dir="$(cd "$( dirname "$0")" && pwd)"
|
|
proj_dir="$(cd "$(dirname "$cur_dir")" && pwd)"
|
|
# create the venv
|
|
pushd "$proj_dir" || (echo "Unable to access the project directory ($proj_dir)." && exit 1)
|
|
python3.9 -m virtualenv venv
|
|
# install the requirements
|
|
source venv/bin/activate
|
|
pip install -Ur requirements.txt
|