Skip to content

Commit

Permalink
Update install.sh to fix Github Actions CI
Browse files Browse the repository at this point in the history
Previous command to check python version is failing
  • Loading branch information
lanctot authored Dec 5, 2024
1 parent f68f2a3 commit f64a834
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions open_spiel/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ ${PYBIN} --version

MYDIR="$(dirname "$(realpath "$0")")"

function check_install_python() {
output=$(brew list --versions | grep "python ${OS_PYTHON_VERSION}")
if [[ "$output" = "" ]]; then
brew install "python@${OS_PYTHON_VERSION}"
fi
return 0
}

# Calling this file from the project root is not allowed,
# as all the paths here are hard-coded to be relative to it.
#
Expand Down Expand Up @@ -288,10 +296,7 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then # Mac OSX
# On Github Actions, macOS comes with Python 3.9.
# We want to test multiple Python versions determined by OS_PYTHON_VERSION.
if [[ "$CI" ]]; then
# Only install the python version if it's not present. There are issues otherwise.
if [[ `brew list python@${OS_PYTHON_VERSION}; echo $?` == 0 ]]; then
brew install "python@${OS_PYTHON_VERSION}"
fi
check_install_python
# Uninstall Python 3.9 if we need to.
brew link --force --overwrite "python@${OS_PYTHON_VERSION}"
fi
Expand Down

0 comments on commit f64a834

Please sign in to comment.