-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
build-wheels.sh
53 lines (39 loc) · 1.59 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
#!/bin/bash -ex
# Compile wheels
cd /io
mkdir -p wheelhouse.final
rm -rf build
rm -rf dist
for P in ${PYTHONS}; do
PYBIN=/opt/python/${P}/bin
"${PYBIN}"/python -m venv .venv
.venv/bin/pip install -U pip wheel cffi setuptools-rust
REGEX="cp3([0-9])*"
if [[ "${PYBIN}" =~ $REGEX ]]; then
PY_LIMITED_API="--py-limited-api=cp3${BASH_REMATCH[1]}"
fi
LDFLAGS="-L/opt/pyca/cryptography/openssl/lib" \
CFLAGS="-I/opt/pyca/cryptography/openssl/include -Wl,--exclude-libs,ALL" \
.venv/bin/python setup.py bdist_wheel $PY_LIMITED_API
auditwheel repair --plat ${PLAT} -w wheelhouse/ dist/cryptography*.whl
# Sanity checks
# NOTE(ianw) : no execstack on aarch64, comes from
# prelink, which was never supported. CentOS 8 does
# have it separate, skip for now.
if [[ ! "${PLAT}" =~ "aarch64" ]]; then
for f in wheelhouse/*.whl; do
unzip $f -d execstack.check
results=$(execstack execstack.check/cryptography/hazmat/bindings/*.so)
count=$(echo "$results" | grep -c '^X' || true)
if [ "$count" -ne 0 ]; then
exit 1
fi
rm -rf execstack.check
done
fi
.venv/bin/pip install cryptography --no-index -f wheelhouse/
.venv/bin/python -c "from cryptography.hazmat.backends.openssl.backend import backend;print('Loaded: ' + backend.openssl_version_text());print('Linked Against: ' + backend._ffi.string(backend._lib.OPENSSL_VERSION_TEXT).decode('ascii'))"
# Cleanup
mv wheelhouse/* wheelhouse.final
rm -rf .venv dist wheelhouse
done