From 46e72ff8eaa08bdd16f9e38371b751544fccfd6a Mon Sep 17 00:00:00 2001 From: Aki Ariga Date: Sun, 29 Mar 2026 18:39:37 -0700 Subject: [PATCH] Fix Windows wheel version with SETUPTOOLS_SCM_PRETEND_VERSION CIBW_BEFORE_BUILD_WINDOWS runs in the project directory (no container isolation), so swig still dirties the git tree. Capture the clean version before swig runs and pass it via SETUPTOOLS_SCM_PRETEND_VERSION so setuptools-scm skips git describe entirely. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/wheels.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 961e38a..2a053d3 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -54,6 +54,13 @@ jobs: - name: Install cibuildwheel run: pip install cibuildwheel==3.4.0 + - name: Get SCM version + id: scm_version + run: | + pip install setuptools-scm + echo "version=$(python -m setuptools_scm)" >> "$GITHUB_OUTPUT" + shell: bash + - name: Prepare for Windows if: runner.os == 'Windows' run: | @@ -74,6 +81,7 @@ jobs: CIBW_BUILD_VERBOSITY: 3 CIBW_BEFORE_ALL_LINUX: bash {project}/.github/workflows/linux-before-all.sh CIBW_BEFORE_BUILD_WINDOWS: swig -Wall -c++ -python -shadow -Iinclude lib\kytea\mykytea.i + CIBW_ENVIRONMENT_WINDOWS: SETUPTOOLS_SCM_PRETEND_VERSION=${{ steps.scm_version.outputs.version }} CIBW_TEST_COMMAND: python {project}/.github/workflows/test-wheel.py CIBW_TEST_COMMAND_WINDOWS: python {project}/.github/workflows/test-wheel.py --model {project}/model.bin run: python -m cibuildwheel --output-dir wheelhouse