Skip to content

Instantly share code, notes, and snippets.

@luca-drf
Last active April 4, 2024 07:43
Show Gist options
  • Save luca-drf/30921511c18559fd6f5c4fa7b94e4615 to your computer and use it in GitHub Desktop.
Save luca-drf/30921511c18559fd6f5c4fa7b94e4615 to your computer and use it in GitHub Desktop.
Build uamqp arm64 manylinux wheel
#!/bin/bash
set -e -u -x
# Usage:
# docker run --rm -e PYVER="cp39-cp39" -e UAMQP_TAG="v.1.6.3" -v $(pwd):/io quay.io/pypa/manylinux2014_aarch64:latest /io/build-uamqp-arm-wheel.sh
PYBIN="/opt/python/$PYVER/bin"
WORKDIR="/var/uamqp"
TESTDIR="/var/uamqp_test"
mkdir -p $WORKDIR
cd $WORKDIR
yum install -y cmake gcc gcc-c++ make openssl-devel python3-devel
git clone -b $UAMQP_TAG --depth 1 https://github.com/Azure/azure-uamqp-python
cd azure-uamqp-python
"$PYBIN/pip" install --upgrade pip setuptools wheel
"$PYBIN/pip" install cython==0.29.21
"$PYBIN/python" setup.py bdist_wheel -d /wheelhouse
rm -rf build/
auditwheel show /wheelhouse/uamqp-*.whl
auditwheel repair /wheelhouse/uamqp-*.whl --plat manylinux2014_aarch64 -w /io/wheelhouse/
# Set up env vars to run live tests - otherwise they will be skipped.
export EVENT_HUB_HOSTNAME=""
export EVENT_HUB_NAME=""
export EVENT_HUB_SAS_POLICY=""
export EVENT_HUB_SAS_KEY=""
export IOTHUB_HOSTNAME=""
export IOTHUB_HUB_NAME=""
export IOTHUB_DEVICE=""
export IOTHUB_ENDPOINT=""
export IOTHUB_SAS_POLICY=""
export IOTHUB_SAS_KEY=""
# Test the wheel
mkdir -p $TESTDIR
cd $TESTDIR
"$PYBIN/python" -m venv env
env/bin/pip install "certifi>=2017.4.17" "six~=1.0" "enum34>=1.0.4" "pytest" "pylint"
env/bin/pip install /io/wheelhouse/uamqp-*.whl
env/bin/python -c 'import uamqp;print("*****Importing uamqp from wheel successful*****")'
env/bin/pytest -v $WORKDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment