File: install-pymbedtls.sh

package info (click to toggle)
python-mbedtls 2.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 960 kB
  • sloc: python: 4,595; sh: 170; makefile: 18
file content (47 lines) | stat: -rwxr-xr-x 991 bytes parent folder | download
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