diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 582980b..5b6f7f8 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -362,11 +362,29 @@ jobs: if: matrix.label == 'macos' run: echo "PYTHON_CMD_X64=${{ steps.python_x64.outputs.python-path }}" >> "$GITHUB_ENV" + - name: Install x86_64 libyaml for universal cx_Freeze slice + if: matrix.label == 'macos' + run: | + set -euo pipefail + # The Rosetta (x86_64) Homebrew lives at /usr/local/bin/brew on + # Apple Silicon GitHub runners. libyaml must be available as + # x86_64 so PyYAML's C extension (_yaml.cpython-3xx-darwin.so) + # compiles for the darwin-x64 cx_Freeze slice. Without this, + # pip falls back to pure Python pyyaml, which is absent from + # the x64 tree while the arm64 tree has the binary, causing + # unify-backend-plain-files.sh to fail. + if [[ -x /usr/local/bin/brew ]]; then + arch -x86_64 /usr/local/bin/brew install libyaml || true + else + echo "x86_64 Homebrew not found at /usr/local/bin/brew; PyYAML C extension may fall back to pure Python for x64 slice." + fi + - name: Install project deps into x64 Python (mac universal cx_Freeze) if: matrix.label == 'macos' env: PY_X64: ${{ steps.python_x64.outputs.python-path }} ARCHFLAGS: "-arch x86_64" + PKG_CONFIG_PATH: "/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig" run: | set -euo pipefail arch -x86_64 "$PY_X64" -m pip install -U pip setuptools wheel diff --git a/scripts/unify-backend-plain-files.sh b/scripts/unify-backend-plain-files.sh index de586e5..0059219 100755 --- a/scripts/unify-backend-plain-files.sh +++ b/scripts/unify-backend-plain-files.sh @@ -27,6 +27,7 @@ fi unified=0 synced=0 +dropped=0 copy_missing() { local src_dir="$1" dst_dir="$2" label="$3" @@ -37,10 +38,13 @@ copy_missing() { local ft ft=$(file --brief --no-pad "$src_file" 2>/dev/null || true) if [[ "$ft" == Mach-O* ]]; then - echo "unify-backend: refusing to copy Mach-O across architecture trees: $rel" >&2 + echo "unify-backend: dropping arch-only Mach-O for consistency: $rel" >&2 echo " ($label); source reports: $ft" >&2 - echo " Fix the cx_Freeze build for ${dst_dir##*/} (darwin-x64 needs x86_64 Python: PYTHON_CMD / PYTHON_CMD_X64)." >&2 - exit 1 + echo " Hint: ensure libyaml is available for x86_64 (arch -x86_64 brew install libyaml)" >&2 + echo " so PyYAML's C extension compiles for darwin-x64 and both trees match." >&2 + rm -f "$src_file" + dropped=$((dropped + 1)) + continue fi mkdir -p "$dst_dir/$(dirname "$rel")" cp "$src_file" "$dst_dir/$rel" @@ -75,6 +79,9 @@ while IFS= read -r -d '' rel; do done < <(cd "$ARM64_DIR" && find . -type f -print0) total=$((unified + synced)) +if [[ $dropped -gt 0 ]]; then + echo "unify-backend: WARNING: dropped $dropped arch-only Mach-O binary/binaries for consistency (pure Python fallback active)" +fi if [[ $total -gt 0 ]]; then echo "unify-backend: synced $synced missing file(s), unified $unified differing file(s)" else