contrib: add a bat file to build all of the wheels on Windows stable
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 14 Nov 2024 16:11:52 -0500
branchstable
changeset 52269 ea9cbb0fa3d3
parent 52268 2e26c21f77ca
child 52270 0b63b7026516
contrib: add a bat file to build all of the wheels on Windows This is duplicated from the current CI config, to be able to build releases consistently outside of CI. I don't like the duplication, but I'm not worried about things changing too often, so I'm not bothering with PowerShell or some form that would allow execution by the CI runner. We should consider putting the config in `pyproject.toml`, where things like what python versions to support can be centrally controlled for all platforms. The output directory is different from CI here, but that's fine because it is intended to run this on a system that is *not* hosting the CI setup, and `dist/` is more standard. I dropped the `win32` part of the output because that implies the 32-bit Intel architecture. Apparently, arm64 builds are supported back to Python 3.9, but support is still experimental (with py3.13)[1]. The CI system starts arm64 support with Python 3.11, because that's the first version that an arm64 Python installer was available on Windows. This doesn't second guess that decision. The required `msgfmt.exe` was installed manually[2], as it isn't currently handled by the dependency installation script. Otherwise, this was successfully used with an activated venv based on Python 3.12.5, and only `cibuildwheel==2.21.3` installed. [1] https://cibuildwheel.pypa.io/en/stable/#what-does-it-do [2] https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.22.5a-v1.17-r3/gettext0.22.5a-iconv1.17-shared-64.exe
contrib/packaging/build-windows-wheels.bat
tests/test-check-code.t
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/packaging/build-windows-wheels.bat	Thu Nov 14 16:11:52 2024 -0500
@@ -0,0 +1,37 @@
+@echo off
+
+REM - This is a convenience script to build all of the wheels outside of the CI
+REM - system.  It requires the cibuildwheel package to be installed, and the
+REM - executable on PATH, as well as `msgfmt.exe` from gettext and the x86,
+REM - amd64, and arm64 compilers from VS BuildTools.  These can be obtained by
+REM - running `contrib/install-windows-dependencies.ps1`.
+
+REM - None of the variable set here live past this script exiting.
+setlocal
+
+REM - Build translations; requires msgfmt.exe on PATH.
+set MERCURIAL_SETUP_FORCE_TRANSLATIONS=1
+
+REM - Prevent building pypy wheels, which is broken.
+set CIBW_SKIP=pp*
+
+REM - Disable warning about not being able to test without an arm64 runner.
+set CIBW_TEST_SKIP=*-win_arm64
+
+
+REM - arm64 support starts with py39, but the first arm64 installer wasn't
+REM - available until py311, so skip arm64 on the older, EOL versions.
+set CIBW_ARCHS=x86 AMD64
+set CIBW_BUILD=cp38-* cp39-* cp310-*
+
+cibuildwheel --output-dir dist/wheels
+
+if %errorlevel% neq 0 exit /b %errorlevel%
+
+
+set CIBW_ARCHS=x86 AMD64 ARM64
+set CIBW_BUILD=cp311-* cp312-* cp313-*
+
+cibuildwheel --output-dir dist/wheels
+
+if %errorlevel% neq 0 exit /b %errorlevel%
--- a/tests/test-check-code.t	Thu Nov 14 15:36:41 2024 -0500
+++ b/tests/test-check-code.t	Thu Nov 14 16:11:52 2024 -0500
@@ -93,5 +93,6 @@
 Keep Windows line endings in check
 
   $ testrepohg files 'set:eol(dos)'
+  contrib/packaging/build-windows-wheels.bat
   contrib/win32/hg.bat
   contrib/win32/mercurial.ini