@@ -501,6 +501,7 @@ jobs:
501501 # 所以必须在 shell 命令内临时设置,delocate 才能找到 libomp.dylib。
502502 # 2. 添加 --require-archs {delocate_archs} 确保打包的 dylib 架构
503503 # 与 .so 文件一致(防止 arm64/x86_64 混淆导致用户端 crash)。
504+ # 3. wheel repair 失败时必须让 CI 失败,不能发布未打包 libomp 的 macOS wheel。
504505 CIBW_REPAIR_WHEEL_COMMAND_MACOS : |
505506 echo "=== Repairing macOS wheel ==="
506507 echo "Current architecture: $(uname -m)"
@@ -510,13 +511,8 @@ jobs:
510511 # 在 repair 命令内部设置 DYLD_LIBRARY_PATH,绕过 macOS SIP 的剥离
511512 DYLD_LIBRARY_PATH="${REPAIR_LIBRARY_PATH}:${DYLD_LIBRARY_PATH:-}" \
512513 delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} || {
513- echo "[WARNING] delocate with --require-archs failed, retrying without arch check..."
514- DYLD_LIBRARY_PATH="${REPAIR_LIBRARY_PATH}:${DYLD_LIBRARY_PATH:-}" \
515- delocate-wheel -w {dest_dir} -v {wheel} || {
516- echo "[WARNING] delocate failed completely, copying wheel as-is"
517- mkdir -p {dest_dir}
518- cp {wheel} {dest_dir}/
519- }
514+ echo "[ERROR] delocate failed; refusing to publish an unrepaired macOS wheel."
515+ exit 1
520516 }
521517
522518 # 验证修复结果:确认 libomp 是否真的打包进去了
@@ -528,7 +524,8 @@ jobs:
528524 if delocate-listdeps --all "$REPAIRED_WHEEL" 2>&1 | grep -q "libomp"; then
529525 echo "[OK] libomp successfully bundled into wheel"
530526 else
531- echo "[WARNING] libomp may not be bundled - check wheel manually"
527+ echo "[ERROR] libomp is not bundled into the macOS wheel."
528+ exit 1
532529 fi
533530 fi
534531
@@ -544,9 +541,15 @@ jobs:
544541 python -m pip install --upgrade pip
545542 echo "Ensuring clean build environment..."
546543
547- # 再次清理,确保没有残留的构建文件
548- find . -name "*.so" -delete 2>/dev/null || true
549- find . -name "*.c" -delete 2>/dev/null || true
544+ # 再次清理,确保没有残留的项目构建文件;不要全仓库扫描依赖/实验目录。
545+ find ./sequenzo -name "*.so" -type f -delete 2>/dev/null || true
546+ find . -maxdepth 1 -name "*.so" -type f -delete 2>/dev/null || true
547+ find ./sequenzo -path "*/utils/*.c" -type f -print0 | while IFS= read -r -d '' cfile; do
548+ pyxfile="${cfile%.c}.pyx"
549+ if [ -f "$pyxfile" ]; then
550+ rm -f "$cfile"
551+ fi
552+ done
550553 rm -rf build/ dist/ *.egg-info
551554
552555 echo "Clean build environment ready"
@@ -567,11 +570,10 @@ jobs:
567570 echo "=== Attempting wheel repair ==="
568571 echo "Wheel to repair: {wheel}"
569572
570- # 尝试修复,如果失败则跳过修复
573+ # wheel repair 失败时必须让 CI 失败,不能发布未修复 wheel。
571574 auditwheel repair -w {dest_dir} {wheel} || {
572- echo "[WARNING] auditwheel repair failed, copying wheel as-is"
573- mkdir -p {dest_dir}
574- cp {wheel} {dest_dir}/
575+ echo "[ERROR] auditwheel repair failed; refusing to publish an unrepaired Linux wheel."
576+ exit 1
575577 }
576578
577579 # 检查修复结果
@@ -1289,4 +1291,4 @@ jobs:
12891291 uses : actions/upload-artifact@v4
12901292 with :
12911293 name : wheels-${{ matrix.os }}-${{ matrix.python-version }}
1292- path : dist/
1294+ path : dist/
0 commit comments