.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
- language: generic
os: osx
env: TOXENV=py35-cov
env: TOXENV=py36-cov
install:
- ./.travis/install.sh

View File

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

View File

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