From 91332bf3485be6a00f61c37f7de551d2d551e8a1 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 14 Dec 2014 06:20:23 -0600 Subject: [PATCH] Use our own retry command since travis_retry is not exported Use our own retry command since travis_retry is not exported Reinstate the MPL settings Fix the order of the MPL settings Fix the MPL versions Streamline the section headers Adjust min MPL requirement for the Ubuntu version Force pip to not install matplotlib and scipy --- requirements.txt | 2 +- tools/travis_before_install.sh | 37 ++++++++++++++------ tools/travis_script.sh | 62 ++++++++++++++++++---------------- 3 files changed, 61 insertions(+), 40 deletions(-) diff --git a/requirements.txt b/requirements.txt index 189b627b..a879d652 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ cython>=0.19.2 -matplotlib>=1.1.0 +matplotlib>=1.0 numpy>=1.6.1 scipy>=0.9 six>=1.3 diff --git a/tools/travis_before_install.sh b/tools/travis_before_install.sh index fc6df38e..03828fd2 100755 --- a/tools/travis_before_install.sh +++ b/tools/travis_before_install.sh @@ -1,10 +1,24 @@ #!/usr/bin/env bash +set -ex export WHEELHOUSE="--no-index --find-links=http://travis-wheels.scikit-image.org/" -repip () { - travis_retry pip $@ +retry () { + # https://gist.github.com/fungusakafungus/1026804 + local retry_max=3 + local count=$retry_max + while [ $count -gt 0 ]; do + "$@" && break + count=$(($count - 1)) + sleep 1 + done + + [ $count -eq 0 ] && { + echo "Retry failed [$retry_max]: $@" >&2 + return 1 + } + return 0 } @@ -15,37 +29,40 @@ if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then sudo apt-get install python-scipy python-matplotlib sed -i 's/cython>=/cython==/g' requirements.txt sed -i 's/networkx>=/networkx==/g' requirements.txt + sed -i '/matplotlib/d' requirements.txt + sed -i '/scipy/d' requirements.txt else virtualenv -p python --system-site-packages ~/venv fi source ~/venv/bin/activate -repip install wheel flake8 coveralls nose +retry pip install wheel flake8 coveralls nose # install system tk for matplotlib sudo apt-get install python-tk # on Python 3.2, use matplotlib 1.3.1 -if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then +if [[ $TRAVIS_PYTHON_VERSION == 3.2 ]]; then sed -i 's/matplotlib>=*.*.*/matplotlib==1.3.1/g' requirements.txt fi -repip install $WHEELHOUSE -r requirements.txt +retry pip install $WHEELHOUSE -r requirements.txt # clean up disk space sudo apt-get clean sudo rm -rf /tmp/* -fold_start () { +section () { echo -en "travis_fold:start:$1\r" + tools/header.py $1 } -fold_end () { +section_end () { echo -en "travis_fold:end:$1\r" } -export -f fold_start -export -f fold_end -export -f repip +export -f section +export -f section_end +export -f retry diff --git a/tools/travis_script.sh b/tools/travis_script.sh index fea6bbbc..ffd21f26 100755 --- a/tools/travis_script.sh +++ b/tools/travis_script.sh @@ -1,31 +1,25 @@ #!/usr/bin/env bash set -ex -fold_start "script.setup" +section "Script Setup" sh -e /etc/init.d/xvfb start export DISPLAY=:99.0 PYTHONWARNINGS="all" TEST_ARGS="--exe --ignore-files=^_test -v --with-doctest --ignore-files=^setup.py$" -fold_end "script.setup" +section_end "Script Setup" -fold_start "test.min" -tools/header.py "Test with min requirements" - +section "Test with min requirements" nosetests $TEST_ARGS skimage -fold_end "test.min" +section_end "Test with min requirements" -fold_start "test.flake8" -tools/header.py "Flake8 test" - +section "Flake8 test" flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples -fold_end "test.flake8" +section_end "Flake8 test" - -fold_start "install.all" -tools/header.py "Install optional dependencies" +section "Install optional dependencies" # Install Qt and then update the Matplotlib settings if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then @@ -47,37 +41,42 @@ if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then else sudo apt-get install -q libqt4-dev - repip install -q PySide $WHEELHOUSE + retry pip install -q PySide $WHEELHOUSE python ~/venv/bin/pyside_postinstall.py -install 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 - repip install -q imread + retry pip install -q imread fi # Install SimpleITK from wheelhouse if available (not 3.2 or 3.4) if [[ $TRAVIS_PYTHON_VERSION =~ 3\.[24] ]]; then echo "SimpleITK unavailable on $TRAVIS_PYTHON_VERSION" else - repip install -q SimpleITK $WHEELHOUSE + retry pip install -q SimpleITK $WHEELHOUSE fi sudo apt-get install -q libfreeimage3 -repip install -q astropy $WHEELHOUSE +retry pip install -q astropy $WHEELHOUSE if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then - repip install -q pyamg + retry pip install -q pyamg fi -repip install -q tifffile +retry pip install -q tifffile -fold_end "install.all" +section_end "Install optional dependencies" -fold_start "doc.examples" -tools/header.py "Run doc examples" +section "Run doc examples" + +# Matplotlib settings - do not show figures during doc examples +MPL_DIR=$HOME/.config/matplotlib +mkdir -p $MPL_DIR +touch $MPL_DIR/matplotlibrc +echo 'backend : Template' > $MPL_DIR/matplotlibrc for f in doc/examples/*.py; do python "$f" @@ -86,11 +85,10 @@ for f in doc/examples/*.py; do fi done -fold_end "doc.examples" +section_end "Run doc examples" -fold_start "doc.applications" -tools/header.py "Run doc applications" +section "Run doc applications" for f in doc/examples/applications/*.py; do python "$f" @@ -100,14 +98,20 @@ for f in doc/examples/applications/*.py; do done # Now configure Matplotlib to use Qt4 +if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then + MPL_QT_API=PyQt4 + export QT_API=pyqt +else + MPL_QT_API=PySide + export QT_API=pyside +fi echo 'backend: Agg' > $MPL_DIR/matplotlibrc echo 'backend.qt4 : '$MPL_QT_API >> $MPL_DIR/matplotlibrc -fold_end "doc.applications" +section_end "Run doc applications" -fold_start "test.all" -tools/header.py "Test with optional dependencies" +section "Test with optional dependencies" # run tests again with optional dependencies to get more coverage if [[ $TRAVIS_PYTHON_VERSION == 3.3 ]]; then @@ -115,4 +119,4 @@ if [[ $TRAVIS_PYTHON_VERSION == 3.3 ]]; then fi nosetests $TEST_ARGS -fold_end "test.all" +section_end "Test with optional dependencies"