Skip to content

Commit

Permalink
Add cibuildwheel script for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ideoforms committed Oct 29, 2024
1 parent f0f79ec commit 4b2f07d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion auxiliary/cibuildwheel/make-raspberry-pi-aarch64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
27 changes: 27 additions & 0 deletions auxiliary/cibuildwheel/make-windows-amd64.py
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit 4b2f07d

Please sign in to comment.