-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_and_test.sh
More file actions
executable file
·49 lines (36 loc) · 1.26 KB
/
Copy pathsetup_and_test.sh
File metadata and controls
executable file
·49 lines (36 loc) · 1.26 KB
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
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# Bootstrap virtualenv, install dependencies, and run sanity checks for the color deconvolution project.
set -euo pipefail
# Resolve repository root
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_DIR="${REPO_DIR}/.venv"
RUN_APP=0
if [[ "${1:-}" == "--run-app" ]]; then
RUN_APP=1
fi
# Helper for logging
log() { printf '\n[setup] %s\n' "$1"; }
log "Repository: ${REPO_DIR}"
if [ ! -d "${VENV_DIR}" ]; then
log "Creating virtual environment at ${VENV_DIR}"
python3 -m venv "${VENV_DIR}"
fi
log "Activating virtual environment"
# shellcheck source=/dev/null
source "${VENV_DIR}/bin/activate"
log "Upgrading pip"
pip install --upgrade pip > /dev/null
log "Installing project dependencies"
pip install -r "${REPO_DIR}/app/requirements.txt"
log "Exporting project on PYTHONPATH"
export PYTHONPATH="${REPO_DIR}:${PYTHONPATH:-}"
log "Running unit tests"
python -m unittest discover -s "${REPO_DIR}/tests"
log "Byte-compiling sources"
python -m compileall "${REPO_DIR}/color_deconvolution.py" "${REPO_DIR}/app"
log "Setup complete. Launch the GUI with:"
log " source ${VENV_DIR}/bin/activate && PYTHONPATH=${REPO_DIR} python -m app.main"
if (( RUN_APP )); then
log "Launching GUI"
PYTHONPATH="${REPO_DIR}:${PYTHONPATH:-}" python -m app.main
fi