Skip to content

Commit c2f30ea

Browse files
committed
Fix Travis build on OSX
As noticed in PR #42, Travis was not installing the different Python versions correctly anymore.
1 parent c078af0 commit c2f30ea

File tree

2 files changed

+18
-30
lines changed

2 files changed

+18
-30
lines changed

.travis.yml

+6-30
Original file line numberDiff line numberDiff line change
@@ -14,50 +14,26 @@ matrix:
1414
dist: xenial
1515
sudo: required
1616
python: 3.7
17-
# - os: linux
18-
# dist: trusty
19-
# sudo: required
20-
# python: pypy
21-
# Travis does not support yet Python installation on OSX (see https://github.com/travis-ci/travis-ci/issues/2312).
22-
# We will therefore only test with the preinstalled Python 2.7
2317
- os: osx
2418
language: generic
25-
env: PYTHON=2.7-dev
19+
env: PYTHON=2.7.15
2620
- os: osx
2721
language: generic
28-
env: PYTHON=3.5
22+
env: PYTHON=3.5.6
2923
- os: osx
3024
language: generic
31-
env: PYTHON=3.6
25+
env: PYTHON=3.6.7
3226
- os: osx
3327
language: generic
34-
env: PYTHON=3.7
28+
env: PYTHON=3.7.1
3529

3630
before_install: |
37-
# These steps are taken from https://pythonhosted.org/CodeChat/.travis.yml.html
3831
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
39-
brew update
40-
# Per the `pyenv homebrew recommendations <https://github.com/yyuu/pyenv/wiki#suggested-build-environment>`_.
41-
brew install openssl readline
42-
# See https://docs.travis-ci.com/user/osx-ci-environment/#A-note-on-upgrading-packages.
43-
# I didn't do this above because it works and I'm lazy.
44-
brew outdated pyenv || brew upgrade pyenv
45-
# virtualenv doesn't work without pyenv knowledge. venv in Python 3.3
46-
# doesn't provide Pip by default. So, use `pyenv-virtualenv <https://github.com/yyuu/pyenv-virtualenv/blob/master/README.md>`_.
47-
brew install pyenv-virtualenv
48-
pyenv install $PYTHON
49-
# I would expect something like ``pyenv init; pyenv local $PYTHON`` or
50-
# ``pyenv shell $PYTHON`` would work, but ``pyenv init`` doesn't seem to
51-
# modify the Bash environment. ??? So, I hand-set the variables instead.
52-
export PYENV_VERSION=$PYTHON
53-
export PATH="/Users/travis/.pyenv/shims:${PATH}"
54-
pyenv-virtualenv venv
55-
source venv/bin/activate
56-
# A manual check that the correct version of Python is running.
57-
python --version
32+
source .travis_osx.sh
5833
fi
5934
6035
install:
36+
- python --version
6137
- pip install hypothesis Cython wheel
6238

6339
script:

.travis_osx.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These steps are taken from https://pythonhosted.org/CodeChat/.travis.yml.html
2+
brew update
3+
brew install openssl readline
4+
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
5+
export PATH="${HOME}/.pyenv/bin:${PATH}"
6+
eval "$(pyenv init -)"
7+
eval "$(pyenv virtualenv-init -)"
8+
pyenv install $PYTHON
9+
export PYENV_VERSION=$PYTHON
10+
export PATH="/Users/travis/.pyenv/shims:${PATH}"
11+
pyenv virtualenv venv
12+
pyenv activate venv

0 commit comments

Comments
 (0)