.travis/*.sh: use homebrew python3 instead of compiling python3 from source with pyenv

This should speed it up a bit, as brew will download a pre-compiled "bottle", whereas pyenv compiles python from source.

The current 'python3' formula on homebrew is 3.6.0, so let's use that.
This commit is contained in:
Cosimo Lupo 2016-12-26 16:44:01 +00:00
parent 17706a4f94
commit 4fcbebcb38
No known key found for this signature in database
GPG Key ID: B61AAAD0B53A6419
4 changed files with 33 additions and 36 deletions

View File

@ -22,7 +22,7 @@ matrix:
env: TOXENV=py27-cov env: TOXENV=py27-cov
- language: generic - language: generic
os: osx os: osx
env: TOXENV=py35-cov env: TOXENV=py36-cov
install: install:
- ./.travis/install.sh - ./.travis/install.sh

View File

@ -3,5 +3,9 @@
set -e set -e
set -x set -x
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
source .venv/bin/activate
fi
# upload coverage data to Codecov.io # upload coverage data to Codecov.io
[[ ${TOXENV} == *"-cov"* ]] && python -m tox -e codecov [[ ${TOXENV} == *"-cov"* ]] && tox -e codecov

View File

@ -3,34 +3,31 @@
set -e set -e
set -x set -x
pip_options="--upgrade"
ci_requirements="pip setuptools tox" ci_requirements="pip setuptools tox"
if [[ "$(uname -s)" == 'Darwin' ]]; then if [ "$TRAVIS_OS_NAME" == "osx" ]; then
# install pyenv from the git repo (quicker than using brew) if [[ ${TOXENV} == *"py27"* ]]; then
git clone https://github.com/yyuu/pyenv.git ~/.pyenv # install pip on the system python
PYENV_ROOT="$HOME/.pyenv" curl -O https://bootstrap.pypa.io/get-pip.py
PATH="$PYENV_ROOT/bin:$PATH" python get-pip.py --user
eval "$(pyenv init -)" # install virtualenv and create virtual environment
python -m pip install --user virtualenv
case "${TOXENV}" in python -m virtualenv .venv/
py27) elif [[ ${TOXENV} == *"py3"* ]]; then
# install pip on the system python # install/upgrade current python3 with homebrew
curl -O https://bootstrap.pypa.io/get-pip.py if brew list --versions python3 > /dev/null; then
python get-pip.py --user brew upgrade python3
;; else
py35) brew install python3
pyenv install 3.5.2 fi
pyenv global 3.5.2 # create virtual environment
;; python3 -m venv .venv/
esac else
pyenv rehash echo "unsupported $TOXENV: "${TOXENV}
exit 1
# add --user option so we don't require sudo fi
pip_options="$pip_options --user" # activate virtual environment
else source .venv/bin/activate
# on Linux, we're already in a virtualenv; no --user required
:
fi fi
python -m pip install $pip_options $ci_requirements python -m pip install $ci_requirements

View File

@ -3,12 +3,8 @@
set -e set -e
set -x set -x
if [[ "$(uname -s)" == "Darwin" ]]; then if [ "$TRAVIS_OS_NAME" == "osx" ]; then
PYENV_ROOT="$HOME/.pyenv" source .venv/bin/activate
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
fi fi
# tox script may not be in the $PATH if we installed as --user tox
# so we run it as module
python -m tox