Skip to content

Commit

Permalink
Added Homebrew Python checks
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidz00 committed May 11, 2024
1 parent 3688327 commit 2bd7c44
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,18 @@ clean_up() {
trap 'clean_up "Received SIGINT (CTRL+C by user)"' SIGINT
trap 'clean_up "Received SIGTERM (Termination signal received)"' SIGTERM

check_homebrew_python() {
local python_path=$(which python3)
local brew_prefix=$(brew --prefix 2>/dev/null)

if [[ "$python_path" == "$brew_prefix"* ]]; then
local site_packages_path="$brew_prefix/lib/python$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')/site-packages"
export PYTHONPATH="$site_packages_path:$PYTHONPATH"
fmt_warning "You are using the Homebrew version of Python. It's recommended to use a virtual environment for project dependencies."
echo "$site_packages_path has been added to your PYTHONPATH."
fi
}

copy_v0() {
# Copies .env file and fonts directory from initial Patcher release location ($HOME/.patcher)
local old_path="$HOME/.patcher"
Expand Down Expand Up @@ -465,6 +477,8 @@ main() {
exit 1
}

check_homebrew_python

while [[ "$#" -gt 0 ]]; do
case $1 in
-d|--develop)
Expand Down

0 comments on commit 2bd7c44

Please sign in to comment.