|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +set -ex |
| 4 | + |
| 5 | +PY_VERSION=$TRAVIS_PYTHON_VERSION |
| 6 | +WHEELHOUSE_URI=http://travis-wheels.scikit-image.org/ |
| 7 | + |
| 8 | +install_conda() |
| 9 | +{ |
| 10 | + # Define the value to download |
| 11 | + if [ "$TRAVIS_OS_NAME" = "linux" ]; then |
| 12 | + MINICONDA_OS=$MINICONDA_LINUX; |
| 13 | + elif [ "$TRAVIS_OS_NAME" = "osx" ]; then |
| 14 | + MINICONDA_OS=$MINICONDA_OSX; |
| 15 | + fi |
| 16 | + |
| 17 | + # You may want to periodically update this, although the conda update |
| 18 | + # conda line below will keep everything up-to-date. We do this |
| 19 | + # conditionally because it saves us some downloading if the version is |
| 20 | + # the same. |
| 21 | + |
| 22 | + if [ "$PY_VERSION" = "2.7" ]; then |
| 23 | + wget "http://repo.continuum.io/miniconda/Miniconda-$MINICONDA_VERSION-$MINICONDA_OS.sh" -O miniconda.sh; |
| 24 | + else |
| 25 | + wget "http://repo.continuum.io/miniconda/Miniconda3-$MINICONDA_VERSION-$MINICONDA_OS.sh" -O miniconda.sh; |
| 26 | + fi |
| 27 | + |
| 28 | + bash miniconda.sh -b -p "$HOME/miniconda"; |
| 29 | + export PATH="$HOME/miniconda/bin:$PATH"; |
| 30 | + hash -r; |
| 31 | + conda config --set always_yes yes --set changeps1 no; |
| 32 | + conda update -q conda; |
| 33 | + |
| 34 | + # Useful for debugging any issues with conda |
| 35 | + conda info -a; |
| 36 | + |
| 37 | + # Test environments for different Qt bindings |
| 38 | + if [ "$USE_QT_API" = "PyQt5" ]; then |
| 39 | + #sudo apt-get install -q "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev |
| 40 | + #sudo apt-get install -q libxcb-sync0-dev libxcb-render-util0 libxcb-image0 libxcb-xfixes0 libxcb-randr0 libxcb-keysyms1 |
| 41 | + #sudo cp- /usr/lib/libxcb-render-util.so.0 /usr/lib/x86_64-linux-gnu/libxcb-render-util.so.0 |
| 42 | + |
| 43 | + sudo apt-get install -q "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev |
| 44 | + #sudo ln -sf /usr/lib/x86_64-linux-gnu/libxcb-render-util.so.0 /usr/lib/libxcb-render-util.so.0 |
| 45 | + |
| 46 | + conda config --add channels dsdale24; |
| 47 | + conda create -q -n test-environment python=$PY_VERSION sphinx sip qt5 pyqt5; |
| 48 | + ldd "$HOME/miniconda/envs/test-environment/lib/qt5/plugins/platforms/libqxcb.so" |
| 49 | + |
| 50 | + # libxcb-atom1-dev libxcb-event1-dev libxcb-icccm1-dev |
| 51 | + # ldd /home/goanpeca/anaconda/envs/test-environment/lib/qt5/plugins/platforms/libqxcb.so |
| 52 | + # |
| 53 | + elif [ "$USE_QT_API" = "PyQt4" ]; then |
| 54 | + conda create -q -n test-environment python=$PY_VERSION sphinx sip qt pyqt; |
| 55 | + elif [ "$USE_QT_API" = "PySide" ]; then |
| 56 | + conda create -q -n test-environment python=$PY_VERSION sphinx sip qt pyside; |
| 57 | + fi |
| 58 | + |
| 59 | + conda install -q -n test-environment $TEST_PACKAGES |
| 60 | +} |
| 61 | + |
| 62 | +install_pyside() |
| 63 | +{ |
| 64 | + # Currently support for python 2.7, 3.3, 3.4 |
| 65 | + # http://stackoverflow.com/questions/24489588/how-can-i-install-pyside-on-travis |
| 66 | + sudo apt-get install libqt4-dev; |
| 67 | + pip install --upgrade pip; |
| 68 | + pip install PySide --no-index --find-links=$WHEELHOUSE_URI; |
| 69 | + # Travis CI servers use virtualenvs, so we need to finish the install by the following |
| 70 | + POSTINSTALL=$(find ~/virtualenv/ -type f -name "pyside_postinstall.py";) |
| 71 | + python $POSTINSTALL -install; |
| 72 | +} |
| 73 | + |
| 74 | +install_qt4() |
| 75 | +{ |
| 76 | + # Install Qt and then update the Matplotlib settings |
| 77 | + sudo apt-get install -q libqt4-dev pyqt4-dev-tools; |
| 78 | + |
| 79 | + if [[ $PY_VERSION == 2.7* ]]; then |
| 80 | + sudo apt-get install python-dev |
| 81 | + sudo apt-get install -q python-qt4 |
| 82 | + else |
| 83 | + sudo apt-get install python3-dev |
| 84 | + fi |
| 85 | + |
| 86 | + # http://stackoverflow.com/a/9716100 |
| 87 | + LIBS=( PyQt4 sip.so ) |
| 88 | + |
| 89 | + VAR=( $(which -a python$PY_VERSION) ) |
| 90 | + |
| 91 | + GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())" |
| 92 | + LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD") |
| 93 | + LIB_SYSTEM_PATH=$(${VAR[-1]} -c "$GET_PYTHON_LIB_CMD") |
| 94 | + |
| 95 | + for LIB in ${LIBS[@]} |
| 96 | + do |
| 97 | + sudo ln -sf $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB |
| 98 | + done |
| 99 | +} |
| 100 | + |
| 101 | +install_qt5() |
| 102 | +{ |
| 103 | + echo "Not supported yet" |
| 104 | +} |
| 105 | + |
| 106 | + |
| 107 | +install_apt_pip() |
| 108 | +{ |
| 109 | + # Test for different Qt bindings |
| 110 | + if [ "$USE_QT_API" = "PyQt5" ]; then |
| 111 | + #sudo apt-get install -qq python-sip python-qt5 python-sphinx --fix-missing; |
| 112 | + #sudo apt-get install -qq python3-sip python3-pyqt5 --fix-missing; |
| 113 | + install_qt5 |
| 114 | + elif [ "$USE_QT_API" = "PyQt4" ]; then |
| 115 | + install_qt4; |
| 116 | + elif [ "$USE_QT_API" = "PySide" ]; then |
| 117 | + install_pyside; |
| 118 | + fi |
| 119 | + |
| 120 | + if [ "$PY_VERSION" = "2.7" ]; then |
| 121 | + TEST_PACKAGES+=" rope" |
| 122 | + fi |
| 123 | + pip install -U $TEST_PACKAGES |
| 124 | +} |
| 125 | + |
| 126 | +if [ "$USE_CONDA" = true ] ; then |
| 127 | + export TEST_PACKAGES="ipython-qtconsole matplotlib pandas pep8 psutil pyflakes pygments pylint sphinx sympy" |
| 128 | + export SOURCE=`source activate test-environment` |
| 129 | + install_conda; |
| 130 | +else |
| 131 | + export TEST_PACKAGES="IPython jedi matplotlib pandas pep8 psutil pyflakes pygments pylint sphinx sympy" |
| 132 | + install_apt_pip; |
| 133 | +fi |
| 134 | + |
| 135 | +#sleep 60; |
0 commit comments