From 916c27e5bd8a8fe72d1cbdb11640c99aa234d29e Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 30 May 2025 13:04:30 -0500 Subject: [PATCH] Add Windows x86-32 emulation support to interpreter architecture checks --- crates/uv-python/src/platform.rs | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/crates/uv-python/src/platform.rs b/crates/uv-python/src/platform.rs index 1ccb0832e..7a1bbe42e 100644 --- a/crates/uv-python/src/platform.rs +++ b/crates/uv-python/src/platform.rs @@ -142,14 +142,30 @@ impl Arch { // TODO: Implement `variant` support checks - // Windows ARM64 runs emulated x86_64 binaries transparently - // Similarly, macOS aarch64 runs emulated x86_64 binaries transparently if you have Rosetta - // installed. We don't try to be clever and check if that's the case here, we just assume - // that if x86_64 distributions are available, they're usable. - if (cfg!(windows) || cfg!(target_os = "macos")) - && matches!(self.family, target_lexicon::Architecture::Aarch64(_)) - { - return other.family == target_lexicon::Architecture::X86_64; + if cfg!(windows) { + match (self.family, other.family) { + // Windows aarch64 runs emulated x86_64 binaries transparently + ( + target_lexicon::Architecture::Aarch64(_), + target_lexicon::Architecture::X86_64, + ) + // Windows x86_64 runs emulated x86_32 binaries transparently + | (target_lexicon::Architecture::X86_64, target_lexicon::Architecture::X86_32(_)) => { + return true + } + _ => {} + } + } else if cfg!(target_os = "macos") { + match (self.family, other.family) { + // macOS aarch64 runs emulated x86_64 binaries transparently if you have Rosetta + // installed. We don't try to be clever and check if that's the case here, we just assume + // that if x86_64 distributions are available, they're usable. + ( + target_lexicon::Architecture::Aarch64(_), + target_lexicon::Architecture::X86_64, + ) => return true, + _ => {} + } } false