Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit fbb0e26

Browse files
authored
build: update windows build script to use trimmed python version (#279)
1 parent 9a26b14 commit fbb0e26

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

scripts/windows/build.bat

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ FOR %%P IN (3.9, 3.10, 3.11, 3.12, 3.13.1) DO (
3131
echo "Listing available Python versions'
3232
py -0
3333

34-
py -%%P-64 -m pip install --upgrade pip
34+
set python_version=%%P
35+
set python_version_trimmed=!python_version:~0,4!
36+
37+
py -!python_version_trimmed!-64 -m pip install --upgrade pip
3538

3639
echo "Installing cmake for Python %%P"
37-
py -%%P-64 -m pip install cmake
40+
py -!python_version_trimmed!-64 -m pip install cmake
3841

3942
@rem Add directory as safe to avoid "detected dubious ownership" fatal issue
4043
git config --global --add safe.directory %cd%
@@ -56,9 +59,9 @@ FOR %%P IN (3.9, 3.10, 3.11, 3.12, 3.13.1) DO (
5659

5760
echo "Running cmake with Generator: %CMAKE_GENERATOR%, Platform: x64, Install Prefix: %CRC32C_INSTALL_PREFIX%"
5861

59-
py -%%P-64 -m cmake -G %CMAKE_GENERATOR% -A x64 -DCRC32C_BUILD_BENCHMARKS=no -DCRC32C_BUILD_TESTS=no -DBUILD_SHARED_LIBS=yes -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=yes -DCRC32C_USE_GLOG=0 -DCMAKE_INSTALL_PREFIX:PATH=%CRC32C_INSTALL_PREFIX% ..
62+
py -!python_version_trimmed!-64 -m cmake -G %CMAKE_GENERATOR% -A x64 -DCRC32C_BUILD_BENCHMARKS=no -DCRC32C_BUILD_TESTS=no -DBUILD_SHARED_LIBS=yes -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=yes -DCRC32C_USE_GLOG=0 -DCMAKE_INSTALL_PREFIX:PATH=%CRC32C_INSTALL_PREFIX% ..
6063

61-
py -%%P-64 -m cmake --build . --config "%CONFIGURATION%" --target install
64+
py -!python_version_trimmed!-64 -m cmake --build . --config "%CONFIGURATION%" --target install
6265

6366
dir %CRC32C_INSTALL_PREFIX% /b /s
6467
popd
@@ -67,14 +70,14 @@ FOR %%P IN (3.9, 3.10, 3.11, 3.12, 3.13.1) DO (
6770
echo "Copying Binary to root: %CRC32C_INSTALL_PREFIX%\bin\crc32c.dll"
6871
copy %CRC32C_INSTALL_PREFIX%\bin\crc32c.dll .
6972

70-
py -%%P-64 -m pip install --upgrade pip setuptools wheel
73+
py -!python_version_trimmed!-64 -m pip install --upgrade pip setuptools wheel
7174
echo "Building C extension"
72-
py -%%P-64 setup.py build_ext -v --include-dirs=%CRC32C_INSTALL_PREFIX%\include --library-dirs=%CRC32C_INSTALL_PREFIX%\lib
75+
py -!python_version_trimmed!-64 setup.py build_ext -v --include-dirs=%CRC32C_INSTALL_PREFIX%\include --library-dirs=%CRC32C_INSTALL_PREFIX%\lib
7376
echo "Building Wheel"
74-
py -%%P-64 -m pip wheel . --wheel-dir wheels/
77+
py -!python_version_trimmed!-64 -m pip wheel . --wheel-dir wheels/
7578

7679
echo "Built wheel, now running tests."
77-
call %~dp0/test.bat %%P || goto :error
80+
call %~dp0/test.bat !python_version_trimmed! || goto :error
7881

7982
echo "Finished with Python version %%P, now uninstalling"
8083
choco uninstall python -y

0 commit comments

Comments
 (0)