Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit 6e448b6

Browse files
committed
Optimize build times and run tests on each build
Use stock boost for Manylinux2010 or install just few necessary header-only boost libraries. Run tests when possibile (available shapely binary wheel or libgeos in distribution, i.e. no tests are run for i686 builds.
1 parent ecc3e0f commit 6e448b6

File tree

1 file changed

+54
-25
lines changed

1 file changed

+54
-25
lines changed

config.sh

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,10 @@
33
# Define custom utilities
44
# Test for OSX with [ -n "$IS_OSX" ]
55

6-
function pre_build {
7-
# Any stuff that you need to do before you start building the wheels
8-
# Runs in the root directory of this repository.
9-
build_new_zlib
10-
build_bzip2
11-
12-
RETURN_PWD="$(pwd)"
13-
if [ -n "$IS_OSX" ] ; then
14-
brew update
15-
brew install google-sparsehash || true
16-
else
17-
yum install -y sparsehash-devel expat-devel
18-
fi
19-
20-
####
21-
# BOOST
22-
####
6+
CMAKE_BIN_URL_64=https://cmake.org/files/v3.6/cmake-3.6.3-Linux-x86_64.sh
7+
CMAKE_BIN_URL_32=https://cmake.org/files/v3.6/cmake-3.6.3-Linux-i386.sh
238

9+
function build_boost {
2410
mkdir -p boost
2511
cd boost
2612
export BOOST_PREFIX="$(pwd)"
@@ -29,13 +15,48 @@ function pre_build {
2915
BOOST_ROOT="$(pwd)"
3016
cd tools/build
3117
sh bootstrap.sh
32-
./b2 --prefix="${BOOST_PREFIX}" --without-python install
18+
./b2 ../../tools/bcp
3319
cd "${BOOST_ROOT}"
34-
"${BOOST_PREFIX}"/bin/b2 --without-python --prefix="${BOOST_PREFIX}" install > /dev/null
20+
# crc iterator and variant are only components required by libosmium
21+
dist/bin/bcp variant crc iterator "${BOOST_PREFIX}"
22+
# this would try to install all (and fail on binary components)
23+
# find libs -maxdepth 1 -type d | sed -e 's#libs/##' | xargs -I {} dist/bin/bcp {} "${BOOST_PREFIX}" || true
24+
}
25+
26+
function build_cmake {
27+
if [ "x${PLAT}" == "xi686" ] ; then
28+
curl -o /tmp/cmake.sh "${CMAKE_BIN_URL_32}"
29+
else
30+
curl -o /tmp/cmake.sh "${CMAKE_BIN_URL_64}"
31+
fi
32+
(cd / && echo $'y\nn\n' | bash /tmp/cmake.sh)
33+
cmake --version
34+
}
3535

36-
####
37-
# END of BOOST stuff
38-
####
36+
function pre_build {
37+
# Any stuff that you need to do before you start building the wheels
38+
# Runs in the root directory of this repository.
39+
build_new_zlib
40+
build_bzip2
41+
42+
RETURN_PWD="$(pwd)"
43+
if [ -n "$IS_OSX" ] ; then
44+
# do not run homebrew cleanup to save time
45+
export HOMEBREW_NO_INSTALL_CLEANUP="true"
46+
brew update
47+
brew install google-sparsehash boost@1.55
48+
else
49+
# Linux
50+
if [ "$MB_ML_VER" == "1" ] ; then
51+
yum install -y sparsehash-devel
52+
build_cmake
53+
build_boost
54+
fi
55+
if [ "$MB_ML_VER" == "2010" ] ; then
56+
# cmake is already present in image
57+
yum install -y sparsehash-devel expat-devel boost-devel
58+
fi
59+
fi
3960

4061
echo "Using PYTHON_VERSION: ${PYTHON_VERSION}"
4162
export LIBOSMIUM_PREFIX=${RETURN_PWD}/libosmium
@@ -49,8 +70,16 @@ function pre_build {
4970

5071
function run_tests {
5172
# Runs tests on installed distribution from an empty directory
73+
# geos needed for shapely tests (for Linux/python versions with no binary wheels)
74+
# install shapely once libgeos is installed
75+
if [ ! -n "$IS_OSX" ] ; then
76+
# because tests are run in matthewbrett/trusty:32 or matthewbrett/trusty:64 image (debian based), use apt to install libraries for shapely
77+
# try to use binary wheel or install libgeos - or do not run tests at all
78+
pip install --only-binary :all: shapely || (apt update && apt install -y libgeos-dev && pip install shapely) || exit 0
79+
else
80+
pip install shapely
81+
fi
5282
python --version
53-
# python /io/pyosmium/tests/run_tests.py - empty directory - no tests here...
54-
cd /
55-
python -c "import osmium"
83+
cd ../pyosmium/test
84+
python -m nose
5685
}

0 commit comments

Comments
 (0)