Skip to content

Commit

Permalink
Use dedicated scripts for travis install and run.
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban committed Jul 12, 2016
1 parent 3958afc commit 2edb303
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ env:
global:
- TRIAL_REPORTER=text

# Install packages in a virtualenv.
# Install the virtualenv if required.
# Install Python version if required.
install:
- pip install tox tox-travis
- ./.travis/install.sh tox tox-travis


# FIXME: https://twistedmatrix.com/trac/ticket/8373
Expand All @@ -42,5 +45,6 @@ before_script:
- git remote set-branches --add origin trunk
- git fetch origin trunk

# Run tox from the created virtualenv.
script:
- tox
- ./.travis/run.sh
70 changes: 70 additions & 0 deletions .travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/bash
#
# Copied from
# https://github.com/pyca/cryptography/blob/master/.travis/install.sh
#

set -e
set -x

if [[ "$(uname -s)" == 'Darwin' ]]; then
brew update || brew update

brew outdated openssl || brew upgrade openssl

# install pyenv
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)
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
;;
py33)
pyenv install 3.3.6
pyenv global 3.3.6
;;
py34)
pyenv install 3.4.4
pyenv global 3.4.4
;;
py35)
pyenv install 3.5.1
pyenv global 3.5.1
;;
pypy*)
pyenv install "pypy-$PYPY_VERSION"
pyenv global "pypy-$PYPY_VERSION"
;;
pypy3)
pyenv install pypy3-2.4.0
pyenv global pypy3-2.4.0
;;
docs)
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
;;
esac
pyenv rehash
python -m pip install --user virtualenv
else
# temporary pyenv installation to get latest pypy until the travis
# container infra is upgraded
if [[ "${TOXENV}" = pypy* ]]; then
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
pyenv install "pypy-$PYPY_VERSION"
pyenv global "pypy-$PYPY_VERSION"
fi

pip install virtualenv
fi

python -m virtualenv ~/.venv
source ~/.venv/bin/activate
pip install $@
22 changes: 22 additions & 0 deletions .travis/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
#
# Copied from
# https://github.com/pyca/cryptography/blob/master/.travis/run.sh
#
set -e
set -x

if [[ "$(uname -s)" == "Darwin" ]]; then
# initialize our pyenv
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
else
if [[ "${TOXENV}" == "pypy" ]]; then
PYENV_ROOT="$HOME/.pyenv"
PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
fi
fi
source ~/.venv/bin/activate
tox -- $TOX_FLAGS

0 comments on commit 2edb303

Please sign in to comment.