#!/usr/bin/env bash # Build the wheel. Runs INSIDE the OCCT builder image (see ../Makefile), which # supplies the kernel at /opt/occt and cp312 at /opt/python. set -euo pipefail cd /io . scripts/_env.sh echo "--- build (pass 1: compile) ---" rm -rf dist wheelhouse mkdir -p wheelhouse # --no-isolation keeps the build in the cached venv so the CMake tree and # ccache are actually reused between runs. "$PY" -m build --wheel --no-isolation --outdir dist # Stubs are generated by importing the freshly built extension, so they cannot # exist before the first compile — and the wheel is packed from the source # tree, so they would miss this wheel and ship one build stale. Pass 2 repacks # with them present; it is incremental (same CMake tree, warm ccache). echo "--- stubs ---" scripts/stubgen.sh echo "--- build (pass 2: repack with stubs) ---" rm -rf dist "$PY" -m build --wheel --no-isolation --outdir dist echo "--- auditwheel repair ---" auditwheel repair --plat manylinux_2_28_x86_64 -w wheelhouse dist/*.whl echo "--- smoke test (no LD_LIBRARY_PATH: proves the wheel is self-contained) ---" rm -rf "$CACHE/smoke" "$PY" -m venv "$CACHE/smoke" "$CACHE/smoke/bin/pip" install -q wheelhouse/*.whl env -u LD_LIBRARY_PATH "$CACHE/smoke/bin/python" -c " import OCP, n3xd_ocp from OCP.TopoDS import TopoDS_Shape print('OCP', OCP.__version__, '/ OCCT', OCP.__occt_version__) print('modules:', ' '.join(OCP._OCP.__all_modules__)) " ls -la wheelhouse/