forked from MacPython/pytables-wheels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.sh
81 lines (76 loc) · 2.19 KB
/
config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Define custom utilities
# Test for OSX with [ -n "$IS_OSX" ]
LZO_VERSION=2.09
function build_wheel {
local repo_dir=${1:-$REPO_DIR}
if [ -z "$IS_OSX" ]; then
build_linux_wheel $@
else
build_osx_wheel $@
fi
}
function build_libs {
build_bzip2
build_lzo
build_hdf5
}
function build_linux_wheel {
source multibuild/library_builders.sh
build_libs
# Add workaround for auditwheel bug:
# https://github.com/pypa/auditwheel/issues/29
local bad_lib="/usr/local/lib/libhdf5.so"
if [ -z "$(readelf --dynamic $bad_lib | grep RUNPATH)" ]; then
patchelf --set-rpath $(dirname $bad_lib) $bad_lib
fi
export CFLAGS="-std=gnu99 $CFLAGS"
build_bdist_wheel $@
}
function build_osx_wheel {
local repo_dir=${1:-$REPO_DIR}
local wheelhouse=$(abspath ${WHEEL_SDIR:-wheelhouse})
# Build dual arch wheel
export CC=clang
export CXX=clang++
install_pkg_config
# 32-bit wheel
export CFLAGS="-arch i386"
export CXXFLAGS="$CFLAGS"
export FFLAGS="$CFLAGS"
export LDFLAGS="$CFLAGS"
# Build libraries
source multibuild/library_builders.sh
build_libs
# Build wheel
local py_ld_flags="-Wall -undefined dynamic_lookup -bundle"
local wheelhouse32=${wheelhouse}32
mkdir -p $wheelhouse32
export LDFLAGS="$LDFLAGS $py_ld_flags"
export LDSHARED="clang $LDFLAGS $py_ld_flags"
build_pip_wheel "$repo_dir"
mv ${wheelhouse}/*whl $wheelhouse32
# 64-bit wheel
export CFLAGS="-arch x86_64"
export CXXFLAGS="$CFLAGS"
export FFLAGS="$CFLAGS"
export LDFLAGS="$CFLAGS"
unset LDSHARED
# Force rebuild of all libs
rm *-stamp
build_libs
# Build wheel
export LDFLAGS="$LDFLAGS $py_ld_flags"
export LDSHARED="clang $LDFLAGS $py_ld_flags"
build_pip_wheel "$repo_dir"
# Fuse into dual arch wheel(s)
for whl in ${wheelhouse}/*.whl; do
delocate-fuse "$whl" "${wheelhouse32}/$(basename $whl)"
done
}
function run_tests {
# Runs tests on installed distribution from an empty directory
python -m tables.tests.test_all
if [ -n "$IS_OSX" ]; then # Run 32-bit tests on dual arch wheel
arch -i386 python -m tables.tests.test_all
fi
}