mach: Force the use of arm64 Python when running with Windows on arm64 (#42371)

There is currently [a bug in
UV](https://github.com/astral-sh/uv/issues/12906) that results in it
using the x64 flavor of Python when running on Arm64 Windows. This then
causes all Python scripts to believe they are on an x64 device and so
Server installs the wrong dependencies and builds for the wrong
architecture.

Testing: Local on my Arm64 Windows device
Contributes to fixing #40611

Signed-off-by: Daniel Paoliello <daniel@meta-sys.info>
This commit is contained in:
Daniel Paoliello
2026-02-05 18:58:37 -08:00
committed by GitHub
parent aa5854ffe3
commit 0f2adc6f05
2 changed files with 10 additions and 0 deletions

View File

@@ -1,4 +1,8 @@
@echo off @echo off
REM UV defaults to x86_64 Python on Arm64, so we need to override that.
REM https://github.com/astral-sh/uv/issues/12906
if "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( set UV_PYTHON=arm64 )
set workdir=%~dp0 set workdir=%~dp0
uv run --frozen python %workdir%mach %* uv run --frozen python %workdir%mach %*

View File

@@ -23,4 +23,10 @@ if ($arguments.Count -gt 0) {
} }
} }
# UV defaults to x86_64 Python on Arm64, so we need to override that.
# https://github.com/astral-sh/uv/issues/12906
if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq 'Arm64') {
$env:UV_PYTHON='arm64'
}
uv run --frozen python (Join-Path $workdir "mach") @arguments uv run --frozen python (Join-Path $workdir "mach") @arguments