Skip to content

Commit e85af3c

Browse files
committed
Merge pull request #248 from micahcochran/caching
Travis: cache pip and compiled libgeos binaries
2 parents 25fcba6 + d3cc6d1 commit e85af3c

File tree

1 file changed

+39
-29
lines changed

1 file changed

+39
-29
lines changed

.travis.yml

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ addons:
2222

2323
language: python
2424

25-
cache: pip
25+
cache:
26+
directories:
27+
# cache for wheels generated by pip
28+
- $HOME/.cache/pip
29+
# cache for libgeos library binaries
30+
- $HOME/.libgeos
2631

2732

2833
# matrix generates 6 test cases
@@ -54,7 +59,7 @@ matrix:
5459
- python: 3.4
5560
env:
5661
- MPL=matplotlib==1.4.3
57-
# - NUMPY="numpy>=1.9.0,<1.10.0" # use the default install of numpy
62+
- NUMPY=numpy==1.9.3
5863

5964
# "latest and greatest" stable environments
6065
# this uses the current stable versions
@@ -88,47 +93,52 @@ matrix:
8893
# - source venv/bin/activate
8994

9095
install:
91-
# Upgrade pip and setuptools. Mock has issues with the default version of
92-
# setuptools
96+
# Upgrade pip and setuptools. Install wheel.
9397
- pip install --upgrade pip
94-
- pip install --upgrade setuptools
98+
- pip install --upgrade setuptools
99+
- pip install wheel
95100

96101
# the development version of numpy requires Cython
97102
- if [[ $TRAVIS_PYTHON_VERSION == 'nightly' ]]; then pip install --install-option="--no-cython-compile" Cython; fi
98103

99-
# workaround for "middle of the road" configuration to use pre-installed numpy, others "upgrade" numpy
100-
- if [[ $TRAVIS_PYTHON_VERSION != '3.4' ]]; then pip install --upgrade $NUMPY; fi
101104

102-
- pip install --upgrade $MPL
103-
- pip install --upgrade $PYPROJ
105+
- pip install --upgrade $NUMPY
106+
- pip install $MPL
107+
- pip install $PYPROJ
104108
- pip install -r requirements.txt
105109

106110
# extra requirements to support Python 2.6
107111
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install -r .requirements-2.6.txt; fi
108112

109-
# compile GEOS internally or download external version to compile
110113
- |
114+
# Is libgeos suppose to be built?
111115
if [[ $BUILD_LIBGEOS != 'false' ]]; then
112-
if [[ $BUILD_LIBGEOS == 'internal' ]]; then
113-
echo 'Building internal libgeos'
114-
cd geos-3.3.3
115-
# does this string contain a "git" substring?
116-
elif [[ $BUILD_LIBGEOS == *"git"* ]]; then
117-
echo 'Using git to download libgeos development'
118-
git clone ${BUILD_LIBGEOS}
119-
cd libgeos
120-
./autogen.sh
121-
else
122-
echo 'Downloading and building external libgeos'
123-
wget https://github.com/libgeos/libgeos/archive/${BUILD_LIBGEOS}.tar.gz
124-
tar zxf ${BUILD_LIBGEOS}.tar.gz
125-
cd libgeos-${BUILD_LIBGEOS}
126-
./autogen.sh
116+
export GEOS_DIR=$HOME/.libgeos/${BUILD_LIBGEOS}/
117+
# Does this path (for libgeos binaries) not exist in cache?
118+
if [[ ! -d "$GEOS_DIR" ]] ; then
119+
# Download and Compile libgeos
120+
if [[ $BUILD_LIBGEOS == 'internal' ]]; then
121+
echo 'Building internal libgeos'
122+
cd geos-3.3.3
123+
# Does this string contain a "git" substring?
124+
elif [[ $BUILD_LIBGEOS == *"git"* ]]; then
125+
echo 'Using git to download libgeos development'
126+
git clone ${BUILD_LIBGEOS}
127+
cd libgeos
128+
./autogen.sh
129+
# do NOT cache libgeos git
130+
export GEOS_DIR=$HOME/dont-cache-me/
131+
else
132+
echo 'Downloading and building external libgeos'
133+
wget https://github.com/libgeos/libgeos/archive/${BUILD_LIBGEOS}.tar.gz
134+
tar zxf ${BUILD_LIBGEOS}.tar.gz
135+
cd libgeos-${BUILD_LIBGEOS}
136+
./autogen.sh
137+
fi
138+
./configure --prefix=$GEOS_DIR
139+
make; make install
140+
cd ..
127141
fi
128-
export GEOS_DIR=$HOME/.local/
129-
./configure --prefix=$GEOS_DIR
130-
make; make install
131-
cd ..
132142
fi
133143
# - pip install pep8
134144
- pip install .

0 commit comments

Comments
 (0)