From 4b2f07d2823f67d3c0687b8e2eb02eb689818168 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Tue, 29 Oct 2024 16:39:09 +0000 Subject: [PATCH] Add cibuildwheel script for Windows --- .../cibuildwheel/make-raspberry-pi-aarch64.sh | 3 ++- auxiliary/cibuildwheel/make-windows-amd64.py | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 auxiliary/cibuildwheel/make-windows-amd64.py diff --git a/auxiliary/cibuildwheel/make-raspberry-pi-aarch64.sh b/auxiliary/cibuildwheel/make-raspberry-pi-aarch64.sh index 8978034a..cab51c8c 100755 --- a/auxiliary/cibuildwheel/make-raspberry-pi-aarch64.sh +++ b/auxiliary/cibuildwheel/make-raspberry-pi-aarch64.sh @@ -6,6 +6,7 @@ # # May be ultimately better to switch to this arm runner action: # https://github.com/pguyot/arm-runner-action +# Or at least cibuildwheel #-------------------------------------------------------------------------------- # Fail if any subcommands fail @@ -21,13 +22,13 @@ do python3 -m build --wheel done -echo "Renaming to _armv7l..." SIGNALFLOW_VERSION=$(cat setup.py | grep version= | tr -dc '0-9.') echo "SignalFlow version = $SIGNALFLOW_VERSION" cd dist mkdir $SIGNALFLOW_VERSION for FILE in signalflow-${SIGNALFLOW_VERSION}*_aarch64.whl do + echo "Renaming to _armv7l..." OUTPUT_FILE=$SIGNALFLOW_VERSION/$(echo $FILE | sed 's/aarch64/armv7l/') mv $FILE $OUTPUT_FILE echo "Created product: dist/$OUTPUT_FILE" diff --git a/auxiliary/cibuildwheel/make-windows-amd64.py b/auxiliary/cibuildwheel/make-windows-amd64.py new file mode 100644 index 00000000..b089e6e1 --- /dev/null +++ b/auxiliary/cibuildwheel/make-windows-amd64.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +import os +import re +import glob +import subprocess + +os.environ["CIBW_BUILD"] = "cp*-win_amd64" +os.environ["CIBW_ARCHS_WINDOWS"] = "AMD64" + +rv = subprocess.call(["python", "-m", "cibuildwheel"]) +if rv == 0: + os.chdir("wheelhouse") + wheels = glob.glob("*.whl") + for wheel in wheels: + print(" - %s" % wheel) + # NOTE: cibuildwheel seemed to be formerly creating wheels labelled + # as -win32, this conditional is to catch and correct this. + if re.search("-win32.whl", wheel): + wheel_corrected = re.sub("-win32.whl", "-win_amd64.whl", wheel) + os.rename(wheel, wheel_corrected) + wheel = wheel_corrected + print(" - renamed to %s" % wheel) + print(" - running delvewheel") + subprocess.call(["python", "-m", "delvewheel", "repair", wheel, "--add-path", "dlls"]) +else: + print("Failed to run python -m cibuildwheel") \ No newline at end of file