Skip to content

Commit 396ba43

Browse files
committed
fix: use vswhere to find vcvars64.bat on Windows CI
Replace hardcoded VS 2022 Enterprise path with vswhere dynamic lookup. The windows-latest runner image path for vcvars64.bat has changed, causing 'cl' not found errors. vswhere is pre-installed on all GHA Windows runners and finds the correct VS installation path.
1 parent 0d1ba03 commit 396ba43

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171

7272
- name: Install dependencies
7373
run: |
74-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
74+
for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do call "%%i\VC\Auxiliary\Build\vcvars64.bat"
7575
make develop
7676
shell: cmd
7777
if: matrix.os == 'windows-latest'
@@ -131,12 +131,12 @@ jobs:
131131
- name: Make dist (Windows)
132132
run: |
133133
if exist dist rmdir /s /q dist
134-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
134+
for /f "usebackq tokens=*" %%i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do call "%%i\VC\Auxiliary\Build\vcvars64.bat"
135135
make dist-py-wheel
136136
shell: cmd
137137
env:
138138
CIBW_BUILD: "${{ matrix.cibuildwheel }}-win_amd64"
139-
CIBW_BEFORE_ALL: call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
139+
CIBW_BEFORE_ALL: for /f "usebackq tokens=*" %i in (`vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do call "%i\VC\Auxiliary\Build\vcvars64.bat"
140140
if: matrix.os == 'windows-latest'
141141

142142
- uses: actions-ext/python/test-wheel@main

0 commit comments

Comments
 (0)