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 | # License: 3-clause BSD |
---|
8 | |
---|
9 | |
---|
10 | set -e |
---|
11 | |
---|
12 | |
---|
13 | [ -z "$PYTHON_VERSION" ] && PYTHON_VERSION="2.7" |
---|
14 | |
---|
15 | |
---|
16 | sudo apt-get update -q |
---|
17 | sudo apt-get install gfortran git |
---|
18 | |
---|
19 | ########################################################## |
---|
20 | # Setup various versions of MPI |
---|
21 | if [[ "$ANUGA_PARALLEL" == "mpich2" ]]; then |
---|
22 | sudo apt-get -y install mpich2; |
---|
23 | fi |
---|
24 | |
---|
25 | if [[ "$ANUGA_PARALLEL" == "openmpi" ]]; then |
---|
26 | sudo apt-get install -y libopenmpi-dev openmpi-bin; |
---|
27 | fi |
---|
28 | |
---|
29 | |
---|
30 | ########################################################## |
---|
31 | |
---|
32 | # Deactivate the travis-provided virtual environment and setup a |
---|
33 | # conda-based environment instead |
---|
34 | deactivate || echo "deactivate failed" |
---|
35 | |
---|
36 | # Use the miniconda installer for faster download |
---|
37 | # install of conda itself |
---|
38 | wget http://repo.continuum.io/miniconda/Miniconda-3.8.3-Linux-x86_64.sh \ |
---|
39 | -O miniconda.sh |
---|
40 | chmod +x miniconda.sh && ./miniconda.sh -b |
---|
41 | |
---|
42 | export PATH=$HOME/miniconda/bin:$PATH |
---|
43 | conda update --yes conda |
---|
44 | |
---|
45 | # Configure the conda environment and put it in the path using the |
---|
46 | # provided versions |
---|
47 | conda create -n anuga_env --yes python=$PYTHON_VERSION pip numpy scipy netcdf4 \ |
---|
48 | nose matplotlib |
---|
49 | source activate anuga_env |
---|
50 | |
---|
51 | # python 2.6 doesn't have argparse by default |
---|
52 | if [[ "$PYTHON_VERSION" == "2.6" ]]; then conda install --yes argparse; fi |
---|
53 | |
---|
54 | if [[ "$PYTHON_VERSION" == "2.7" ]]; then |
---|
55 | conda install --yes -c pingucarsti gdal |
---|
56 | fi |
---|
57 | |
---|
58 | if [[ "$PYTHON_VERSION" == "2.6" ]]; then |
---|
59 | conda install --yes gdal geos |
---|
60 | fi |
---|
61 | |
---|
62 | export GDAL_DATA=`gdal-config --datadir`; |
---|
63 | |
---|
64 | # Install more software to deal with geographical projections |
---|
65 | pip install pyproj |
---|
66 | |
---|
67 | # Install pypar if parallel set |
---|
68 | if [[ "$ANUGA_PARALLEL" == "mpich2" || "$ANUGA_PARALLEL" == "openmpi" ]]; then |
---|
69 | git clone https://github.com/daleroberts/pypar.git; |
---|
70 | pushd pypar; |
---|
71 | python setup.py install; |
---|
72 | popd; |
---|
73 | fi |
---|
74 | |
---|
75 | # Useful for debugging any issues with conda |
---|
76 | conda info -a |
---|
77 | |
---|
78 | ######################################################## |
---|
79 | if [[ "$COVERAGE" == "--coverage" ]]; then |
---|
80 | pip install coverage coveralls |
---|
81 | fi |
---|
82 | |
---|
83 | ######################################################## |
---|
84 | # build and install anuga |
---|
85 | |
---|
86 | python setup.py build |
---|
87 | python setup.py install |
---|