From b229f1313c8c815f05be29e2efffda23fa23cbad Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Sat, 20 Jan 2024 16:06:23 +0100 Subject: [PATCH] Added initial functionality to build wheels Signed-off-by: Alejandro Saucedo --- Makefile | 12 ++++++++++-- build_wheels.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100755 build_wheels.sh diff --git a/Makefile b/Makefile index 2e222c0d..e0146643 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,8 @@ else endif endif +PYTHON_BIN := "python3" + ####### Main Target Rules ####### @@ -147,10 +149,16 @@ vs_run_tests: vs_build_tests ./build/test/$(VS_BUILD_TYPE)/bin/kompute_tests.exe --gtest_filter=$(FILTER_TESTS) -#### PYTHONG #### +#### PYTHON #### test_python: - python3 -m pytest -s --log-cli-level=DEBUG -v python/test/ + $(PYTHON_BIN) -m pytest -s --log-cli-level=DEBUG -v python/test/ + +build_wheels: + docker run --rm -it \ + -e PLAT=manylinux_2_28_x86_64 \ + -v $(pwd):/io quay.io/pypa/manylinux_2_28_x86_64 \ + /io/build_wheels.sh ####### Run CI Commands ####### diff --git a/build_wheels.sh b/build_wheels.sh new file mode 100755 index 00000000..9a752fdf --- /dev/null +++ b/build_wheels.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e -u -x + +function repair_wheel { + wheel="$1" + if ! auditwheel show "$wheel"; then + echo "Skipping non-platform wheel $wheel" + else + auditwheel repair "$wheel" --plat "$PLAT" -w /io/dist/ + fi +} + +# System package required for library +yum install -y vulkan +yum install -y vulkan-devel + +# Create folder +mkdir -p /io/dist_tmp/ +mkdir -p /io/dist/ + + +# Compile wheels +for PYBIN in /opt/python/*/bin; do + "${PYBIN}/pip" wheel --verbose /io/ --no-deps -w /io/dist_tmp/ +done + +# Bundle external shared libraries into the wheels +for whl in /io/dist_tmp/*.whl; do + repair_wheel "$whl" && echo "Continuing" +done + +# Install packages and test +for PYBIN in /opt/python/*/bin/; do + "${PYBIN}/pip" install -r /io/python/test/requirements-dev.txt + "${PYBIN}/pip" install kp -f /io/dist + make -C /io/ test_python PYTHON_BIN="${PYBIN}/python" +done +