-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTART_ON_MAC.command
More file actions
executable file
·72 lines (61 loc) · 1.98 KB
/
Copy pathSTART_ON_MAC.command
File metadata and controls
executable file
·72 lines (61 loc) · 1.98 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
set -u
SOURCE_DIR="$(cd "$(dirname "$0")" && pwd)"
INSTALL_DIR="$HOME/Library/Application Support/WorkflowObserver"
RUNTIME_DIR="$INSTALL_DIR/.runtime"
LOG_FILE="$HOME/Library/Logs/WorkflowObserver-setup.log"
UV_BIN="$RUNTIME_DIR/bin/uv"
UV_VERSION="0.12.14"
mkdir -p "$(dirname "$LOG_FILE")"
exec > >(tee -a "$LOG_FILE") 2>&1
fail() {
echo
echo "Setup did not complete. The log is here:"
echo "$LOG_FILE"
echo
read -r -p "Press Enter to close…"
exit 1
}
trap fail ERR
mkdir -p "$INSTALL_DIR"
echo "Preparing Workflow Observer in your user Library…"
# Copy the prototype out of Downloads/quarantined/translocated locations.
# Preserve local runtime, environment, configuration, and captured data.
rsync -a --delete \
--exclude '.venv/' \
--exclude '.runtime/' \
--exclude '.pytest_cache/' \
--exclude '__pycache__/' \
--exclude 'data/' \
--exclude 'config.json' \
"$SOURCE_DIR/" "$INSTALL_DIR/"
cd "$INSTALL_DIR"
export UV_INSTALL_DIR="$RUNTIME_DIR/bin"
export UV_NO_MODIFY_PATH=1
export UV_PYTHON_INSTALL_DIR="$RUNTIME_DIR/python"
export UV_PYTHON_BIN_DIR="$RUNTIME_DIR/python-bin"
export UV_CACHE_DIR="$RUNTIME_DIR/cache"
if [ ! -x "$UV_BIN" ]; then
echo "First-time setup: installing a private app runtime…"
echo "No system Python installation is required."
mkdir -p "$RUNTIME_DIR/bin"
INSTALLER="$RUNTIME_DIR/uv-install.sh"
curl --fail --location --silent --show-error \
"https://astral.sh/uv/${UV_VERSION}/install.sh" \
--output "$INSTALLER"
sh "$INSTALLER"
rm -f "$INSTALLER"
fi
if [ ! -x .venv/bin/python ]; then
echo "First-time setup: downloading Workflow Observer's private Python runtime…"
rm -rf .venv
"$UV_BIN" venv --python 3.12 --managed-python .venv
echo "Installing Workflow Observer dependencies…"
"$UV_BIN" pip install --python .venv/bin/python -e .
fi
if [ ! -f config.json ]; then
cp config.example.json config.json
fi
echo "Starting Workflow Observer…"
trap - ERR
exec .venv/bin/python start.py --mode observe