1+ #! /bin/bash
2+ # This script is meant to be called by the "install" step defined in
3+ # .travis.yml. See http://docs.travis-ci.com/ for more details.
4+ # The behavior of the script is controlled by environment variabled defined
5+ # in the .travis.yml in the top level folder of the project.
6+ #
7+ # This script is adapted from a similar script from the scikit-learn repository.
8+ #
9+ # License: 3-clause BSD
10+
111set -e
212
3- NIPYPE_VERSION=0.13.0
13+ # Fix the compilers to workaround avoid having the Python 3.4 build
14+ # lookup for g++44 unexpectedly.
15+ export CC=gcc
16+ export CXX=g++
17+
18+ create_new_venv () {
19+ # At the time of writing numpy 1.9.1 is included in the travis
20+ # virtualenv but we want to be in control of the numpy version
21+ # we are using for example through apt-get install
22+ deactivate
23+ virtualenv --system-site-packages testvenv
24+ source testvenv/bin/activate
25+ pip install nose
26+ }
427
528print_conda_requirements () {
629 # Echo a conda requirement string for example
7- # "pip python=2.7.3 scikit-learn=*". It has a hardcoded
30+ # "pip nose python=' 2.7.3 scikit-learn=*". It has a hardcoded
831 # list of possible packages to install and looks at _VERSION
932 # environment variables to know whether to install a given package and
1033 # if yes which version to install. For example:
1134 # - for numpy, NUMPY_VERSION is used
1235 # - for scikit-learn, SCIKIT_LEARN_VERSION is used
1336 TO_INSTALL_ALWAYS=" pip nose"
1437 REQUIREMENTS=" $TO_INSTALL_ALWAYS "
15- TO_INSTALL_MAYBE=" python numpy scipy scikit-learn pandas matplotlib networkx flake8 "
38+ TO_INSTALL_MAYBE=" python numpy scipy matplotlib scikit-learn pandas flake8 networkx configobj "
1639 for PACKAGE in $TO_INSTALL_MAYBE ; do
1740 # Capitalize package name and add _VERSION
1841 PACKAGE_VERSION_VARNAME=" ${PACKAGE^^} _VERSION"
@@ -29,43 +52,76 @@ print_conda_requirements() {
2952}
3053
3154create_new_conda_env () {
32- # Deactivate the travis-provided virtual environment and setup a
33- # conda-based environment instead
34- deactivate
55+ # Skip Travis related code on circle ci.
56+ if [ -z $CIRCLECI ]; then
57+ # Deactivate the travis-provided virtual environment and setup a
58+ # conda-based environment instead
59+ deactivate
60+ fi
3561
3662 # Use the miniconda installer for faster download / install of conda
3763 # itself
3864 wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh \
39- -O miniconda.sh
40- chmod +x miniconda.sh && ./miniconda.sh -b
41- export PATH=/home/travis/miniconda2/bin:$PATH
42- conda update --yes conda
65+ -O ~ /miniconda.sh
66+ chmod +x ~ /miniconda.sh && ~ /miniconda.sh -b
67+ export PATH=$HOME /miniconda2/bin:$PATH
68+ echo $PATH
69+ conda update --quiet --yes conda
4370
4471 # Configure the conda environment and put it in the path using the
4572 # provided versions
4673 REQUIREMENTS=$( print_conda_requirements)
4774 echo " conda requirements string: $REQUIREMENTS "
48- conda create -n testenv --yes $REQUIREMENTS
75+ conda create -n testenv --quiet -- yes $REQUIREMENTS
4976 source activate testenv
77+
78+ if [[ " $INSTALL_MKL " == " true" ]]; then
79+ # Make sure that MKL is used
80+ conda install --quiet --yes mkl
81+ elif [[ -z $CIRCLECI ]]; then
82+ # Travis doesn't use MKL but circle ci does for speeding up examples
83+ # generation in the html documentation.
84+ # Make sure that MKL is not used
85+ conda remove --yes --features mkl || echo " MKL not installed"
86+ fi
5087}
5188
5289if [[ " $DISTRIB " == " neurodebian" ]]; then
90+ create_new_venv
91+ pip install nose-timer
5392 bash <( wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
54- sudo apt-get install -qq python-scipy python-nose python-nibabel python-sklearn python-pandas python-networkx python-nipype
55- sudo apt-get install -qq python-pip
56- pip install " nilearn>=0.1.3"
93+ sudo apt-get install -qq python-scipy python-nose python-nibabel python-sklearn
94+
5795elif [[ " $DISTRIB " == " conda" ]]; then
5896 create_new_conda_env
97+ pip install nose-timer
98+ # Note: nibabel is in setup.py install_requires so nibabel will
99+ # always be installed eventually. Defining NIBABEL_VERSION is only
100+ # useful if you happen to want a specific nibabel version rather
101+ # than the latest available one.
102+ if [ -n " $NIBABEL_VERSION " ]; then
103+ pip install nibabel==" $NIBABEL_VERSION "
104+ fi
105+ if [ -n " $NIPYPE_VERSION " ]; then
106+ pip install nipype==" $NIPYPE_VERSION "
107+ fi
108+ if [ -n " $NILEARN_VERSION " ]; then
109+ pip install nilearn==" $NILEARN_VERSION "
110+ fi
59111
60- # dependencies that are only available through pip
61- pip install nilearn> =0.1.3 nipype==${NIPYPE_VERSION} configobj
62112else
63- echo " Unknown distrib: $DISTRIB "
113+ echo " Unrecognized distribution ( $DISTRIB ); cannot setup CI environment. "
64114 exit 1
65115fi
66116
67- python setup.py install
117+ pip install psutil memory_profiler
68118
69119if [[ " $COVERAGE " == " true" ]]; then
70- pip install coverage coveralls
120+ pip install codecov
121+ fi
122+
123+ # numpy not installed when skipping the tests so we do not want to run
124+ # setup.py install
125+ if [[ " $SKIP_TESTS " != " true" ]]; then
126+ python setup.py install
71127fi
0 commit comments