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
|
#!/bin/sh
# vim:noet:ts=2:sw=2:tw=79
set -e
if [ $# -eq 0 ] || [ $# -gt 2 ]; then
cat <<- EOF
usage:
$0 LIBDIR [ VERSION ]
Install python-mbedtls locally, using mbedtls from LIBDIR
The script requires 'delocate' on MacOS or 'auditwheel' on Linux.
EOF
exit 1
fi
if [ -n "$(command -v delocate-wheel)" ]; then
fixlib="delocate-wheel -v"
elif [ -n "$(command -v auditwheel)" ]; then
fixlib="auditwheel repair"
else
echo "Missing requirement."
exit 1
fi
libdir="$1"
version="${2:-*}"
python="cp$(python --version 2>&1 | perl -ne '/^Python\ (\d+)\.(\d+)/ && print "$1$2"')"
wheel="python_mbedtls-$version-$python-$python"'*.whl'
C_INCLUDE_PATH="$libdir/include"
LIBRARY_PATH="$libdir/lib"
LD_LIBRARY_PATH=$LIBRARY_PATH
DYLD_LIBRARY_PATH=$LIBRARY_PATH
export C_INCLUDE_PATH
export LIBRARY_PATH
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
python setup.py bdist_wheel || exit 1
$fixlib dist/$wheel || exit 1
pip install --upgrade --force-reinstall dist/$wheel || exit 1
|