From cde041f7024fcac948418cd3b1d87adad7f3435a Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Wed, 14 Jul 2021 19:20:12 -0600 Subject: [PATCH] install hdf5 and c-blosc on mac if using python3.9 --- setup.sh | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/setup.sh b/setup.sh index 631c31df2..ee3fee0a3 100755 --- a/setup.sh +++ b/setup.sh @@ -17,6 +17,15 @@ function check_installed_python() { exit 2 fi + which python3.9 + if [ $? -eq 0 ]; then + echo "using Python 3.9" + PYTHON=python3.9 + check_installed_pip + return + fi + + which python3.8 if [ $? -eq 0 ]; then echo "using Python 3.8" @@ -25,13 +34,6 @@ function check_installed_python() { return fi - which python3.9 - if [ $? -eq 0 ]; then - echo "using Python 3.9" - PYTHON=python3.9 - check_installed_pip - return - fi which python3.7 if [ $? -eq 0 ]; then @@ -122,6 +124,25 @@ function install_talib() { cd .. } +function install_mac_newer_python_dependencies() { + + if [ ! $(brew --prefix --installed hdf5 2>/dev/null) ] + then + echo "-------------------------" + echo "Installing hdf5" + echo "-------------------------" + brew install hdf5 + fi + + if [ ! $(brew --prefix --installed c-blosc 2>/dev/null) ] + then + echo "-------------------------" + echo "Installing c-blosc" + echo "-------------------------" + brew install c-blosc + fi +} + # Install bot MacOS function install_macos() { if [ ! -x "$(command -v brew)" ] @@ -131,6 +152,12 @@ function install_macos() { echo "-------------------------" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" fi + #Gets number after decimal in python version + version=$(egrep -o 3.\[0-9\]+ <<< $PYTHON | sed 's/3.//g' ) + + if [[ $version -ge 9 ]]; then #Checks if python version >= 3.9 + install_mac_newer_python_dependencies + fi install_talib test_and_fix_python_on_mac }