Skip to content

Commit

Permalink
Update install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
lanctot authored Dec 5, 2024
1 parent 426892e commit 7f0d66c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions open_spiel/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ MYDIR="$(dirname "$(realpath "$0")")"
function check_install_python() {
# Need the trap here to make sure the return value of grep being 1 doesn't cause set -e to fail
# https://stackoverflow.com/questions/77047127/bash-capture-stderr-of-a-function-while-using-trap
rm -f /usr/local/bin/2to3-${OS_PYTHON_VERSION}
rm -f /usr/local/bin/idle${OS_PYTHON_VERSION}
rm -f /usr/local/bin/pydoc${OS_PYTHON_VERSION}
rm -f /usr/local/bin/python${OS_PYTHON_VERSION}*
trap 'ret=0; output=$(brew list --versions | grep "python ${OS_PYTHON_VERSION}") || ret="$?"; trap - RETURN' RETURN
if [[ "$output" = "" ]]; then
brew install "python@${OS_PYTHON_VERSION}"
# The --force is needed because there seems to be a phantom installation in /usr/local/
# and errors show up for files that already exist
brew install --force "python@${OS_PYTHON_VERSION}"
fi
return 0
}
Expand Down

0 comments on commit 7f0d66c

Please sign in to comment.