-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.sh
110 lines (97 loc) · 3.33 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Custom utilities for Rasterio wheels.
#
# Test for OSX with [ -n "$IS_OSX" ].
function fetch_unpack {
# Fetch input archive name from input URL
# Parameters
# url - URL from which to fetch archive
# archive_fname (optional) archive name
#
# Echos unpacked directory and file names.
#
# If `archive_fname` not specified then use basename from `url`
# If `archive_fname` already present at download location, use that instead.
local url=$1
if [ -z "$url" ];then echo "url not defined"; exit 1; fi
local archive_fname=${2:-$(basename $url)}
local arch_sdir="${ARCHIVE_SDIR:-archives}"
if [ -z "$IS_MACOS" ]; then
local extension=${archive_fname##*.}
if [ "$extension" == "xz" ]; then
ensure_xz
fi
fi
# Make the archive directory in case it doesn't exist
mkdir -p $arch_sdir
local out_archive="${arch_sdir}/${archive_fname}"
# If the archive is not already in the archives directory, get it.
if [ ! -f "$out_archive" ]; then
# Source it from multibuild archives if available.
local our_archive="${MULTIBUILD_DIR}/archives/${archive_fname}"
if [ -f "$our_archive" ]; then
ln -s $our_archive $out_archive
else
# Otherwise download it.
curl --insecure -L $url > $out_archive
fi
fi
# Unpack archive, refreshing contents, echoing dir and file
# names.
rm_mkdir arch_tmp
install_rsync
(cd arch_tmp && \
untar ../$out_archive && \
ls -1d * &&
rsync --delete -ah * ..)
}
function build_geos {
CFLAGS="$CFLAGS -g -O2"
CXXFLAGS="$CXXFLAGS -g -O2"
build_simple geos $GEOS_VERSION https://download.osgeo.org/geos tar.bz2
}
function pre_build {
suppress build_geos
}
function run_tests {
if [ -n "$IS_OSX" ]; then
export PATH=$PATH:${BUILD_PREFIX}/bin
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
else
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
fi
mkdir -p /tmp/shapely && cp -R ../shapely/tests /tmp/shapely
cd /tmp/shapely && python -m pytest -vv -k "not test_fallbacks and not test_minimum_clearance" tests
}
function pip_wheel_cmd {
local abs_wheelhouse=$1
pip wheel -v $(pip_opts) -w $abs_wheelhouse --no-deps .
}
function build_wheel_cmd {
# Builds wheel with named command, puts into $WHEEL_SDIR
#
# Parameters:
# cmd (optional, default "pip_wheel_cmd"
# Name of command for building wheel
# repo_dir (optional, default $REPO_DIR)
#
# Depends on
# REPO_DIR (or via input argument)
# WHEEL_SDIR (optional, default "wheelhouse")
# BUILD_DEPENDS (optional, default "")
# MANYLINUX_URL (optional, default "") (via pip_opts function)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${BUILD_PREFIX}/lib
local cmd=${1:-pip_wheel_cmd}
local repo_dir=${2:-$REPO_DIR}
[ -z "$repo_dir" ] && echo "repo_dir not defined" && exit 1
local wheelhouse=$(abspath ${WHEEL_SDIR:-wheelhouse})
start_spinner
if [ -n "$(is_function "pre_build")" ]; then pre_build; fi
stop_spinner
if [ -n "$BUILD_DEPENDS" ]; then
pip install $(pip_opts) $BUILD_DEPENDS
fi
(cd $repo_dir && PIP_NO_BUILD_ISOLATION=0 PIP_USE_PEP517=0 $cmd $wheelhouse)
repair_wheelhouse $wheelhouse
}