Prepare macOS package and improve output handling
This commit is contained in:
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -u
|
||||
|
||||
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||
|
||||
pause_on_exit() {
|
||||
printf '\nPress Return to close this window...'
|
||||
read -r _
|
||||
}
|
||||
trap pause_on_exit EXIT
|
||||
|
||||
fail() {
|
||||
printf '\nError: %s\n' "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd "$SCRIPT_DIR" || fail "Could not open the project directory."
|
||||
|
||||
command -v python3 >/dev/null 2>&1 || fail \
|
||||
"python3 was not found. Install Python 3, then run this installer again."
|
||||
|
||||
if [ ! -x ".venv/bin/python" ] || ! ".venv/bin/python" -m pip --version >/dev/null 2>&1; then
|
||||
printf 'Creating virtual environment...\n'
|
||||
python3 -m venv --clear .venv || fail \
|
||||
"Could not create .venv. Make sure your Python installation includes venv support."
|
||||
else
|
||||
printf 'Using existing virtual environment.\n'
|
||||
fi
|
||||
|
||||
printf 'Installing dependencies...\n'
|
||||
".venv/bin/python" -m pip install -r requirements.txt || fail \
|
||||
"Dependency installation failed."
|
||||
|
||||
printf '\nInstallation completed successfully.\n'
|
||||
printf 'You can now run radioeins-top100.command.\n'
|
||||
Reference in New Issue
Block a user