Merge pull request #5271 from samgermain/setup-mac-fix

setup.sh mac fix
This commit is contained in:
Matthias 2021-07-15 12:13:47 +02:00 committed by GitHub
commit 708d5691b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,35 +17,20 @@ function check_installed_python() {
exit 2 exit 2
fi fi
which python3.8 for v in 8 9 7
do
PYTHON="python3.${v}"
which $PYTHON
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "using Python 3.8" echo "using ${PYTHON}"
PYTHON=python3.8
check_installed_pip check_installed_pip
return return
fi fi
done
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
echo "using Python 3.7"
PYTHON=python3.7
check_installed_pip
return
fi
if [ -z ${PYTHON} ]; then
echo "No usable python found. Please make sure to have python3.7 or newer installed" echo "No usable python found. Please make sure to have python3.7 or newer installed"
exit 1 exit 1
fi
} }
function updateenv() { function updateenv() {
@ -122,6 +107,25 @@ function install_talib() {
cd .. 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 # Install bot MacOS
function install_macos() { function install_macos() {
if [ ! -x "$(command -v brew)" ] if [ ! -x "$(command -v brew)" ]
@ -131,8 +135,13 @@ function install_macos() {
echo "-------------------------" echo "-------------------------"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi 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 install_talib
test_and_fix_python_on_mac
} }
# Install bot Debian_ubuntu # Install bot Debian_ubuntu
@ -189,19 +198,6 @@ function reset() {
updateenv updateenv
} }
function test_and_fix_python_on_mac() {
if ! [ -x "$(command -v python3.6)" ]
then
echo "-------------------------"
echo "Fixing Python"
echo "-------------------------"
echo "Python 3.6 is not linked in your system. Fixing it..."
brew link --overwrite python
echo
fi
}
function config() { function config() {
echo "-------------------------" echo "-------------------------"