ARver/utils/build-wheels.sh
arcctgx 1d75a3394e adapt build script to building a single wheel
With the introduction of Python limited API we're building wheel only
with Python 3.7. We're not iterating over available Python interpreters
anymore and there's no need to remove symlinks to unsupported versions.

Change the wheel directory so that both source distribution and the
wheel end up in dist/. Remove the initial non-manylinux wheels, but
don't remove entire directory before building, only remove the wheel
files. Otherwise the source distribution would be removed as well.

Simplify iterating over wheel files. Finding and sorting is not needed
anymore, because only a single wheel file is expected.
2024-11-23 02:32:23 +01:00

37 lines
1.1 KiB
Bash
Executable file

#!/bin/bash -eux
# Script for building manylinux wheels. Adapted from pypa/python-manylinux-demo.
# This script is the entry point of arcctgx/arver-builder container. It expects
# package sources to be available in /package directory inside the container.
# This can be achieved with Docker bind mount, e.g.:
#
# docker run --rm -u 1000:100 -v "$(pwd):/package" arcctgx/arver-builder
#
platform="manylinux2014_x86_64"
package_dir="/package"
wheel_dir="${package_dir}/dist"
if [[ ! -d "${package_dir}" ]]; then
echo "The directory ${package_dir} is not available inside container."
exit 1
fi
# start with clean state:
rm -rf "${package_dir}/build" "${wheel_dir}/*.whl"
# Py_LIMITED_API 0x03070000 is defined, so it's sufficient to build
# just one wheel with Python 3.7:
python3.7 -m pip wheel "${package_dir}" --wheel-dir "${wheel_dir}"
# vendor required shared libraries in wheels:
for wheel in "${wheel_dir}"/*.whl
do
if ! auditwheel show "${wheel}"; then
echo "Skipping non-platform wheel ${wheel}"
continue
fi
auditwheel repair "${wheel}" --plat "${platform}" --strip --wheel-dir "${wheel_dir}"
rm -v "${wheel}"
done