Skip to content

Commit 5446efe

Browse files
ColCarrolltwiecki
authored andcommitted
BLD Refactor build (#1290)
* Add manifest * Tidy setup.py * Add install miniconda script * Refactoring build * Add debugging messages * Bash is hard * Set python versions correctly * Trying it out * Remove some debug messages * Factor out more test utilities * More nits * Remove changes to manifest and setup for now
1 parent c396430 commit 5446efe

File tree

4 files changed

+71
-16
lines changed

4 files changed

+71
-16
lines changed

.travis.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,23 @@ python:
55
- "3.4"
66

77
before_install:
8-
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; fi
9-
- chmod +x miniconda.sh
10-
- ./miniconda.sh -b
11-
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then export PATH=/home/travis/miniconda2/bin:$PATH; else export PATH=/home/travis/miniconda3/bin:$PATH; fi
8+
- . ./scripts/install_miniconda.sh
129
- "export DISPLAY=:99.0"
1310
- "sh -e /etc/init.d/xvfb start"
1411
- if [ ${MATPLOTLIB} = "1.2" ]; then mkdir $HOME/.matplotlib; fi
1512
- if [ ${MATPLOTLIB} = "1.2" ]; then cp ${SRCDIR}/tools/matplotlibrc $HOME/.matplotlib/matplotlibrc; fi
1613
#- mkdir -p $HOME/.config/matplotlib; echo "backend: agg" > $HOME/.config/matplotlib/matplotlibrc
1714

1815
install:
19-
- conda create -n testenv --yes pip python=$TRAVIS_PYTHON_VERSION
20-
- source activate testenv
21-
- conda install --yes jupyter pyzmq numpy scipy nose matplotlib pandas Cython patsy statsmodels joblib
22-
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then conda install --yes mock enum34; fi
23-
- pip install --no-deps numdifftools
24-
- pip install git+https://github.com/Theano/Theano.git
25-
- pip install git+https://github.com/mahmoudimus/nose-timer.git
26-
- python setup.py build_ext --inplace
16+
- . ./scripts/create_testenv.sh
2717

2818
env:
29-
- TESTCMD=" -vv --with-timer -e test_examples -e test_distributions"
30-
- TESTCMD=" -vv --with-timer pymc3.tests.test_distributions"
31-
- TESTCMD=" -vv --with-timer pymc3.tests.test_distributions_random"
19+
- TESTCMD=" -vv --with-timer -e test_examples -e test_distributions" PYTHON_VERSION=${TRAVIS_PYTHON_VERSION}
20+
- TESTCMD=" -vv --with-timer pymc3.tests.test_distributions" PYTHON_VERSION=${TRAVIS_PYTHON_VERSION}
21+
- TESTCMD=" -vv --with-timer pymc3.tests.test_distributions_random" PYTHON_VERSION=${TRAVIS_PYTHON_VERSION}
22+
3223
script:
33-
- THEANO_FLAGS='gcc.cxxflags="-march=core2"' nosetests $TESTCMD
24+
- . ./scripts/test.sh $TESTCMD
3425

3526
after_success:
3627
- bash <(curl -s https://codecov.io/bash)

scripts/create_testenv.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -e # fail on first error
4+
5+
PYTHON_VERSION=${PYTHON_VERSION:-3.4} # if no python specified, use 3.4
6+
7+
conda create -n testenv --yes pip python=${PYTHON_VERSION}
8+
9+
source activate testenv
10+
11+
conda install --yes jupyter pyzmq numpy scipy nose matplotlib pandas Cython patsy statsmodels joblib
12+
if [ ${PYTHON_VERSION} == "2.7" ]; then
13+
conda install --yes mock enum34;
14+
fi
15+
16+
pip install --no-deps numdifftools
17+
pip install git+https://github.com/Theano/Theano.git
18+
pip install git+https://github.com/mahmoudimus/nose-timer.git
19+
20+
python setup.py build_ext --inplace

scripts/install_miniconda.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
set -e # fail on first error
4+
5+
if conda --version > /dev/null 2>&1; then
6+
echo "conda appears to alreaday be installed"
7+
exit 0
8+
fi
9+
10+
PYTHON_VERSION=${PYTHON_VERSION:-3.4} # if no python specified, use 3.4
11+
12+
if [ "$(uname)" == "Darwin" ]; then
13+
URL_OS="MacOSX"
14+
elif [ "$(expr substr "$(uname -s)" 1 5)" == "Linux" ]; then
15+
URL_OS="Linux"
16+
elif [ "$(expr substr "$(uname -s)" 1 10)" == "MINGW32_NT" ]; then
17+
URL_OS="Windows"
18+
fi
19+
20+
echo "Downloading miniconda for $URL_OS"
21+
DOWNLOAD_PATH="miniconda.sh"
22+
23+
if [ ${PYTHON_VERSION} == "2.7" ]; then
24+
wget http://repo.continuum.io/miniconda/Miniconda-latest-$URL_OS-x86_64.sh -O ${DOWNLOAD_PATH};
25+
INSTALL_FOLDER="$HOME/minconda2"
26+
else
27+
wget http://repo.continuum.io/miniconda/Miniconda3-latest-$URL_OS-x86_64.sh -O ${DOWNLOAD_PATH};
28+
INSTALL_FOLDER="$HOME/minconda3"
29+
fi
30+
31+
32+
echo "Installing miniconda for python-$PYTHON_VERSION to $INSTALL_FOLDER"
33+
# install miniconda to home folder
34+
bash ${DOWNLOAD_PATH} -b -p $INSTALL_FOLDER
35+
36+
# tidy up
37+
rm ${DOWNLOAD_PATH}
38+
39+
export PATH="$INSTALL_FOLDER/bin:$PATH"
40+
echo "Adding $INSTALL_FOLDER to PATH. Consider adding it in your .rc file as well."
41+
conda update -q conda

scripts/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
THEANO_FLAGS='gcc.cxxflags="-march=core2"' nosetests "$@"

0 commit comments

Comments
 (0)