Merge pull request #5271 from samgermain/setup-mac-fix
setup.sh mac fix
This commit is contained in:
		
							
								
								
									
										78
									
								
								setup.sh
									
									
									
									
									
								
							
							
						
						
									
										78
									
								
								setup.sh
									
									
									
									
									
								
							| @@ -17,35 +17,20 @@ function check_installed_python() { | |||||||
|         exit 2 |         exit 2 | ||||||
|     fi |     fi | ||||||
|  |  | ||||||
|     which python3.8 |     for v in 8 9 7 | ||||||
|     if [ $? -eq 0 ]; then |     do | ||||||
|         echo "using Python 3.8" |         PYTHON="python3.${v}" | ||||||
|         PYTHON=python3.8 |         which $PYTHON | ||||||
|         check_installed_pip |         if [ $? -eq 0 ]; then | ||||||
|         return |             echo "using ${PYTHON}" | ||||||
|     fi |  | ||||||
|  |  | ||||||
|     which python3.9 |             check_installed_pip | ||||||
|     if [ $? -eq 0 ]; then |             return | ||||||
|         echo "using Python 3.9" |         fi | ||||||
|         PYTHON=python3.9 |     done  | ||||||
|         check_installed_pip |  | ||||||
|         return |  | ||||||
|     fi |  | ||||||
|  |  | ||||||
|     which python3.7 |     echo "No usable python found. Please make sure to have python3.7 or newer installed" | ||||||
|     if [ $? -eq 0 ]; then |     exit 1 | ||||||
|         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" |  | ||||||
|         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 "-------------------------" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user