-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathbuild-wheels.sh
executable file
·75 lines (60 loc) · 2.13 KB
/
build-wheels.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
#!/bin/bash
# Usage: ./build-wheels.sh <workdir> <pyminorversion1> <pyminorversion2> ...
set -e -x
export MANYLINUX=1
export MEDAKA_DIST=1
export WITHDEFLATE=1
arch=$(uname -m)
workdir=$1
shift
echo "Changing cwd to ${workdir}"
cd ${workdir}
if [[ -z "${PACKAGE_NAME}" ]]; then
PACKAGE_NAME='medaka'
fi
PACKAGE_FILE_NAME=${PACKAGE_NAME//-/_}
sed -i "s/__dist_name__ = 'medaka'/__dist_name__ = '${PACKAGE_NAME}'/" setup.py
# some many linux containers are centos-based, others are debian!
if [ -f /etc/centos-release ]; then
yum install -y zlib-devel bzip2 bzip2-devel xz-devel curl-devel openssl-devel ncurses-devel
else
apt update
apt install -y zlib1g-dev libbz2-dev liblzma-dev libncurses5-dev libcurl4-gnutls-dev libssl-dev libffi-dev
fi
rm -rf libhts.a bincache/*
make scripts/mini_align clean libhts.a
mkdir -p wheelhouse
# this only exists after building libhts
LIBDEFLATE=$(ls -d ${PWD}/submodules/libdeflate-*/)
echo "LIBDEFLATE = '${LIBDEFLATE}'"
echo "PYTHON VERSIONS AVAILABLE"
ls /opt/python/
if [[ ${MEDAKA_CPU} ]]; then
extra_index="--extra-index-url https://download.pytorch.org/whl/cpu"
else
extra_index=""
fi
# Compile wheels
for minor in $@; do
PYBIN="/opt/python/cp3${minor}-cp3${minor}/bin"
# auditwheel/issues/102
"${PYBIN}"/pip install --upgrade setuptools pip wheel cffi
"${PYBIN}"/pip wheel --prefer-binary --no-dependencies . -w ./wheelhouse/
done
# Bundle external shared libraries into the wheels
export LD_LIBRARY_PATH=$PWD/libdeflate
for whl in "wheelhouse/${PACKAGE_FILE_NAME}"*.whl; do
LD_LIBRARY_PATH=${LIBDEFLATE} auditwheel repair "${whl}" -w ./wheelhouse/
done
unset LD_LIBRARY_PATH
## Install packages
if [[ "${DO_COUNT_TEST}" == "1" ]]; then
for minor in $@; do
PYBIN="/opt/python/cp3${minor}-cp3${minor}/bin"
"${PYBIN}"/pip install --use-pep517 --prefer-binary -r requirements.txt ${extra_index}
"${PYBIN}"/pip install "${PACKAGE_NAME}" --no-index -f ./wheelhouse
"${PYBIN}"/medaka_counts --print medaka/test/data/test_reads.bam utg000001l:10000-10010
done
fi
mkdir wheelhouse-final
cp wheelhouse/${PACKAGE_FILE_NAME}*manylinux* wheelhouse-final