1#!/bin/bash 2# script to install Python versions under MacOS, as Travis.IO 3# does not have explicit Python support for MacOS 4# Taken from https://github.com/pyca/cryptography and adapted. 5 6if [[ $TRAVIS_OS_NAME == 'osx' ]]; then 7 sw_vers 8 9 # install pyenv 10 git clone --depth 1 https://github.com/pyenv/pyenv ~/.pyenv 11 PYENV_ROOT="$HOME/.pyenv" 12 PATH="$PYENV_ROOT/bin:$PATH" 13 eval "$(pyenv init -)" 14 15 case "${PYTHON}" in 16 py34|py35|py36|py37|py38) 17 pyenv install "${PY_VERSION}" 18 pyenv global "${PY_VERSION}" 19 ;; 20 pypy*) 21 pyenv install "$PYPY_VERSION" 22 pyenv global "$PYPY_VERSION" 23 ;; 24 esac 25 pyenv rehash 26 python -m pip install --user virtualenv 27 python -m virtualenv ~/.venv 28 source ~/.venv/bin/activate 29fi 30 31if [ -n "$PY_VERSION" ] 32then 33 echo Checking Python version... 34 if [ "$(python --version)" != "Python ${PY_VERSION}" ] 35 then 36 echo Incorrect version - expected "${PY_VERSION}". 37 echo Exiting. 38 exit 1 39 fi 40 echo Python version ok. 41fi 42 43if ! [[ $VM == 'Docker' ]]; then 44pip install -r requirements.txt 45pip install -r extra_requirements.txt 46pip install . 47fi