diff options
author | chrBrd <chris@binaryspanner.com> | 2018-07-30 17:04:09 +0100 |
---|---|---|
committer | chrBrd <chris@binaryspanner.com> | 2018-07-30 17:04:09 +0100 |
commit | 72dba8177807165c383e33ad1de84cff8c17f1ad (patch) | |
tree | 30a2964e35fd3b2cd67ece8af333c98c106dc98c | |
parent | 44745649d2ea13585d75dafcfd7c8cd06d271adb (diff) | |
download | xattr-72dba8177807165c383e33ad1de84cff8c17f1ad.tar.gz |
Modify `install.sh` to install PyPy or pyenv if specified in
`travis.yml`.
-rwxr-xr-x | .travis/install.sh | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/.travis/install.sh b/.travis/install.sh index c28cc84..248b4ed 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -3,21 +3,31 @@ set -e set -x -if [[ -n "$PYENV_VERSION" ]]; then - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then - brew update >/dev/null - brew upgrade readline openssl - brew install expat xz - brew upgrade pyenv +install_pypy() { + pypy_dir="/home/travis/pypy" + curl -L "$PYPY_URL" -o "pypy.tar.bz2" + mkdir "$pypy_dir" + tar xf "pypy.tar.bz2" -C "$pypy_dir" --strip-components=1 + if [ -f "$pypy_dir/bin/pypy" ]; then + ln -s "$pypy_dir/bin/pypy" "pypy" + elif [ -f "$pypy_dir/bin/pypy3" ]; then + ln -s "$pypy_dir/bin/pypy3" "pypy" fi + ./pypy -m ensurepip +} + +install_pyenv() { + brew update > /dev/null + brew upgrade readline openssl pyenv eval "$(pyenv init -)" - pyenv install --list - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then - CFLAGS="-I$(xcrun --show-sdk-path)/usr/include /usr/local/opt/expat/include $CFLAGS" \ - pyenv install -s "$PYENV_VERSION" - else - pyenv install -s "$PYENV_VERSION" - fi + pyenv install -sv "$PYENV_VERSION" + pip install --upgrade pip pyenv rehash python -m pip install wheel -fi +} + +if [[ -n "$PYPY_URL" ]]; then + install_pypy +elif [[ -n "$PYENV_VERSION" && "$TRAVIS_OS_NAME" == "osx" ]]; then + install_pyenv +fi
\ No newline at end of file |