From 71233cca5155f0c6f1199c704304a0876c0d1dce Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 12 Oct 2014 17:05:44 -0500 Subject: [PATCH] Break script into parts and travis_retry optional installs --- .travis.yml | 10 +++++ tools/travis_install_optional.sh | 38 ++++++++++++++++++ tools/travis_setup.sh | 2 - tools/travis_test.sh | 68 -------------------------------- 4 files changed, 48 insertions(+), 70 deletions(-) create mode 100644 tools/travis_install_optional.sh diff --git a/.travis.yml b/.travis.yml index 8dc44224..7a0e2b94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,9 @@ python: - 3.4 before_install: + - export DISPLAY=:99.0 + - export PYTHONWARNINGS="all" + - export WHEELHOUSE="--no-index --find-links=http://wheels.scikit-image.org/" - travis_retry tools/travis_setup.sh install: @@ -22,6 +25,13 @@ install: - python setup.py install script: + - tools/header.py "Run all tests with minimum dependencies" + - nosetests --exe -v skimage + + - tools/header.py "Pep8 and Flake tests" + - flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples + + - travis_retry tools/travis_install_optional.sh - tools/travis_test.sh after_success: diff --git a/tools/travis_install_optional.sh b/tools/travis_install_optional.sh new file mode 100644 index 00000000..c8d55fdf --- /dev/null +++ b/tools/travis_install_optional.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -ex + +tools/header.py "Install optional dependencies" + +# Install Qt and then update the Matplotlib settings +if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then + sudo apt-get install -q python-qt4 + MPL_QT_API=PyQt4 + MPL_DIR=$HOME/.matplotlib + export QT_API=pyqt + +else + sudo apt-get install -q libqt4-dev + pip install PySide $WHEELHOUSE + python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install + MPL_QT_API=PySide + MPL_DIR=$HOME/.config/matplotlib + export QT_API=pyside +fi + +# imread does NOT support py3.2 +if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then + sudo apt-get install -q libtiff4-dev libwebp-dev libpng12-dev xcftools + pip install imread +fi + +# TODO: update when SimpleITK become available on py34 or hopefully pip +if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then + easy_install SimpleITK +fi + +sudo apt-get install libfreeimage3 +pip install astropy + +if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then + pip install pyamg +fi diff --git a/tools/travis_setup.sh b/tools/travis_setup.sh index c9f4c5c8..cefe3a73 100755 --- a/tools/travis_setup.sh +++ b/tools/travis_setup.sh @@ -4,8 +4,6 @@ set -ex sh -e /etc/init.d/xvfb start sudo apt-get update -WHEELHOUSE="--no-index --find-links=http://wheels.scikit-image.org/" - pip install wheel flake8 coveralls nose pip uninstall -y numpy diff --git a/tools/travis_test.sh b/tools/travis_test.sh index 3ed56785..3d35a9b1 100755 --- a/tools/travis_test.sh +++ b/tools/travis_test.sh @@ -1,74 +1,6 @@ #!/usr/bin/env bash set -ex - -export DISPLAY=:99.0 -export PYTHONWARNINGS="all" -WHEELHOUSE="--no-index --find-links=http://wheels.scikit-image.org/" - -tools/header.py "Run all tests with minimum dependencies" -nosetests --exe -v skimage - -tools/header.py "Pep8 and Flake tests" -flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples - -tools/header.py "Install optional dependencies" - -# http://unix.stackexchange.com/a/82615 -function retry() -{ - local n=0 - local try=$3 - local cmd="${@: 1}" - [[ $# -le 1 ]] && { - echo "Usage $0 "; } - - until [[ $n -ge $try ]] - do - $cmd && break || { - echo "Command Fail.." - ((n++)) - echo "retry $n ::" - sleep 1; - } - - done -} - -# Install Qt and then update the Matplotlib settings -if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then - retry sudo apt-get install -q python-qt4 - MPL_QT_API=PyQt4 - MPL_DIR=$HOME/.matplotlib - export QT_API=pyqt - -else - retry sudo apt-get install -q libqt4-dev - retry pip install PySide $WHEELHOUSE - retry python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install - MPL_QT_API=PySide - MPL_DIR=$HOME/.config/matplotlib - export QT_API=pyside -fi - -# imread does NOT support py3.2 -if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then - retry sudo apt-get install -q libtiff4-dev libwebp-dev libpng12-dev xcftools - retry pip install imread -fi - -# TODO: update when SimpleITK become available on py34 or hopefully pip -if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then - retry easy_install SimpleITK -fi - -retry sudo apt-get install libfreeimage3 -retry pip install astropy - -if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then - retry pip install pyamg -fi - # Matplotlib settings - do not show figures during doc examples mkdir -p $MPL_DIR touch $MPL_DIR/matplotlibrc