-
-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathpython-install.sh
More file actions
31 lines (27 loc) · 883 Bytes
/
python-install.sh
File metadata and controls
31 lines (27 loc) · 883 Bytes
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
#!/bin/bash
abort() {
printf "%s\n" "$@" >&2
exit 1
}
execute() {
if ! "$@"
then abort "$(printf "Failed: %s" "$@")"
fi
}
execute_root() {
execute "sudo" "$@"
}
echo "Adding APT repository..."
execute_root "add-apt-repository" "ppa:deadsnakes/ppa" "-y"
execute_root "apt" "update"
echo "Installing Python 3.12..."
execute_root "apt" "install" "-y" "gcc" "python3.12" "python3.12-dev" "python3.12-venv"
echo "Installing Tcl/Tk..."
execute_root "apt" "install" "-y" "python3.12-tk"
echo "Creating Virtual Environment..."
execute_root "python3.12" "-m" "venv" "/usr/local/leads/venv"
echo "Creating Soft Links..."
execute_root "echo" "#!/bin/bash" > "/bin/python-leads"
execute_root "echo" '/usr/local/leads/venv/bin/python "$@"' >> "/bin/python-leads"
execute_root "chmod" "+x" "/bin/python-leads"
execute_root "ln" "-s" "/usr/local/leads/venv/bin/pip" "/bin/pip-leads"