-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.command
More file actions
executable file
·119 lines (109 loc) · 4.26 KB
/
Copy pathinstall.command
File metadata and controls
executable file
·119 lines (109 loc) · 4.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env bash
# ===================================================================
# DeckScope installer for macOS and Linux
# Run: bash install.sh (or double-click install.command on a Mac)
# ===================================================================
set -u
cd "$(dirname "$0")"
bold=$(tput bold 2>/dev/null || echo ""); dim=$(tput dim 2>/dev/null || echo "")
green=$(tput setaf 2 2>/dev/null || echo ""); red=$(tput setaf 1 2>/dev/null || echo "")
reset=$(tput sgr0 2>/dev/null || echo "")
echo
echo " =============================================================="
echo " ${bold} DeckScope — Installer${reset}"
echo " =============================================================="
echo
echo " This will:"
echo " 1. Check that Python is installed"
echo " 2. Install DeckScope into its own private folder"
echo " 3. Add a launcher you can double-click"
echo " 4. Walk you through setup, step by step"
echo
echo " Changes: this folder, a launcher on your Desktop, and a"
echo " 'deckscope' command in ~/.local/bin (or /usr/local/bin)."
echo
read -r -p " Press Enter to continue (or Ctrl+C to stop) "
# ---------- 1. Python ------------------------------------------------
echo
echo " [1/4] Looking for Python..."
PY=""
for c in python3.13 python3.12 python3.11 python3.10 python3 python; do
if command -v "$c" >/dev/null 2>&1 && \
"$c" -c 'import sys; sys.exit(0 if sys.version_info>=(3,9) else 1)' 2>/dev/null; then
PY="$c"; break
fi
done
if [ -z "$PY" ]; then
echo " ${red}Python 3.9 or newer was not found.${reset}"
echo
if [[ "$(uname)" == "Darwin" ]]; then
echo " On a Mac, the simplest fix is to run:"
echo " ${bold}brew install python${reset}"
echo " or download it from https://www.python.org/downloads/"
else
echo " Install it with your package manager, for example:"
echo " ${bold}sudo apt install python3 python3-venv${reset}"
fi
echo
exit 1
fi
echo " Found: $($PY --version)"
# ---------- 2. venv --------------------------------------------------
echo
echo " [2/4] Setting up a private Python environment..."
echo " ${dim}(this keeps DeckScope from interfering with anything else)${reset}"
if [ ! -d ".venv" ]; then
if ! "$PY" -m venv .venv 2>/dev/null; then
echo " ${red}Could not create the environment.${reset}"
echo " On Debian/Ubuntu you may need: sudo apt install python3-venv"
exit 1
fi
fi
VENVPY="$PWD/.venv/bin/python"
echo
echo " [3/4] Installing DeckScope and its components..."
echo " ${dim}(this takes a minute or two the first time)${reset}"
"$VENVPY" -m pip install --upgrade pip --quiet
if ! "$VENVPY" -m pip install -e ".[all]" --quiet; then
echo " ${red}Installation failed.${reset} Check your internet connection"
echo " and any corporate proxy, then run this installer again."
exit 1
fi
echo " Done."
# ---------- 3. launcher ----------------------------------------------
echo
echo " [4/4] Creating a launcher..."
LAUNCHER="$PWD/DeckScope.command"
cat > "$LAUNCHER" <<LAUNCH
#!/usr/bin/env bash
cd "\$(dirname "\$0")"
exec "$VENVPY" -m deckscope app
LAUNCH
chmod +x "$LAUNCHER"
DESKTOP="$HOME/Desktop"
if [ -d "$DESKTOP" ]; then
ln -sf "$LAUNCHER" "$DESKTOP/DeckScope.command" 2>/dev/null && \
echo " Added 'DeckScope' to your Desktop."
fi
# A `deckscope` command on the PATH, if there's a sane place for one.
for bindir in "$HOME/.local/bin" "/usr/local/bin"; do
if [ -d "$bindir" ] && [ -w "$bindir" ]; then
ln -sf "$PWD/.venv/bin/deckscope" "$bindir/deckscope" 2>/dev/null && \
echo " Added the 'deckscope' command to $bindir."
break
fi
done
# ---------- 4. wizard ------------------------------------------------
echo
echo " =============================================================="
echo " ${bold} Installed. Now let's set it up.${reset}"
echo " =============================================================="
echo
"$VENVPY" -m deckscope setup
echo
echo " =============================================================="
echo " ${green}${bold} All done.${reset}"
echo
echo " Double-click ${bold}DeckScope${reset} on your Desktop any time to open it."
echo " =============================================================="
echo