Use retries where applicable

This commit is contained in:
Steven Silvester
2014-10-12 16:54:37 -05:00
parent c74b652e1e
commit d33833ae59
2 changed files with 33 additions and 11 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ python:
- 3.4
before_install:
- tools/travis_setup.sh
- travis_retry tools/travis_setup.sh
install:
- python setup.py build_ext --inplace
+32 -10
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -ex
export DISPLAY=:99.0
export PYTHONWARNINGS="all"
WHEELHOUSE="--no-index --find-links=http://wheels.scikit-image.org/"
@@ -13,17 +14,38 @@ 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 <Command>"; }
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
sudo apt-get install -q python-qt4
retry 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
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
@@ -31,20 +53,20 @@ 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
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
easy_install SimpleITK
retry easy_install SimpleITK
fi
sudo apt-get install libfreeimage3
pip install astropy
retry sudo apt-get install libfreeimage3
retry pip install astropy
if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then
pip install pyamg
retry pip install pyamg
fi
# Matplotlib settings - do not show figures during doc examples