@@ -146,18 +146,74 @@ jobs:
146146 run : |
147147 python -m cibuildwheel --output-dir wheelhouse
148148
149- - name : Fix Permissions
150- if : runner.os == 'Linux' || runner.os == 'macOS'
149+ # Add this new step immediately after the Build wheels step
150+ - name : Repair Linux wheels
151+ if : runner.os == 'Linux'
152+ run : |
153+ echo "Repairing Linux wheels with auditwheel..."
154+ pip install auditwheel
155+ mkdir -p repaired_wheels
156+ for whl in wheelhouse/sparse_numba-*-linux_x86_64.whl; do
157+ if [ -f "$whl" ]; then
158+ echo "Repairing wheel: $whl"
159+ auditwheel repair "$whl" -w repaired_wheels/
160+ else
161+ echo "No Linux wheels found to repair"
162+ fi
163+ done
164+
165+ # List repaired wheels
166+ echo "Repaired wheels:"
167+ ls -la repaired_wheels/
168+
169+ # Replace original wheels with repaired ones
170+ if [ "$(ls -A repaired_wheels/)" ]; then
171+ echo "Replacing original wheels with repaired ones"
172+ cp repaired_wheels/*.whl wheelhouse/
173+ fi
174+
175+ # Final wheel listing
176+ echo "Final wheelhouse contents:"
177+ ls -la wheelhouse/
178+
179+ # For macOS, add a similar step with delocate
180+ - name : Repair macOS wheels
181+ if : runner.os == 'macOS'
151182 run : |
152- find ./wheelhouse -name "*.so" -exec chmod +x {} \;
153- find ./wheelhouse -name "*.so" -exec ls -la {} \;
183+ echo "Repairing macOS wheels with delocate..."
184+ pip install delocate
185+ mkdir -p repaired_wheels
186+ for whl in wheelhouse/sparse_numba-*-macosx_*.whl; do
187+ if [ -f "$whl" ]; then
188+ echo "Repairing wheel: $whl"
189+ delocate-wheel -w repaired_wheels/ "$whl"
190+ else
191+ echo "No macOS wheels found to repair"
192+ fi
193+ done
194+
195+ # List repaired wheels
196+ echo "Repaired wheels:"
197+ ls -la repaired_wheels/
198+
199+ # Replace original wheels with repaired ones
200+ if [ "$(ls -A repaired_wheels/)" ]; then
201+ echo "Replacing original wheels with repaired ones"
202+ cp repaired_wheels/*.whl wheelhouse/
203+ fi
204+
205+ # Final wheel listing
206+ echo "Final wheelhouse contents:"
207+ ls -la wheelhouse/
154208
155209 # Store the built wheels
156210 - name : Upload wheels as artifacts
157211 uses : actions/upload-artifact@v4
158212 with :
159213 name : wheels-${{ matrix.os }}-${{ matrix.python-version }}
160- path : ./wheelhouse/*.whl
214+ path : |
215+ ./wheelhouse/*.whl
216+ ./repaired_wheels/*.whl
161217
162218 # Test job that runs after the wheels are built
163219 test_installation :
0 commit comments