Support x86 windows (#3873)

Add trampolines for x86 windows.

Closes https://github.com/astral-sh/uv/issues/3660.
This commit is contained in:
konsti 2024-05-28 18:07:39 +02:00 committed by GitHub
parent cedd18e4c6
commit f92447772e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 32 additions and 7 deletions

View file

@ -70,7 +70,9 @@ pub enum Error {
RecordCsv(#[from] csv::Error),
#[error("Broken virtualenv: {0}")]
BrokenVenv(String),
#[error("Unable to create Windows launcher for {0} (only x64_64 is supported)")]
#[error(
"Unable to create Windows launcher for: {0} (only x86_64, x86, and arm64 are supported)"
)]
UnsupportedWindowsArch(&'static str),
#[error("Unable to create Windows launcher on non-Windows platform")]
NotWindows,

View file

@ -23,6 +23,14 @@ use crate::{Error, Layout};
const LAUNCHER_MAGIC_NUMBER: [u8; 4] = [b'U', b'V', b'U', b'V'];
#[cfg(all(windows, target_arch = "x86"))]
const LAUNCHER_I686_GUI: &[u8] =
include_bytes!("../../uv-trampoline/trampolines/uv-trampoline-i686-gui.exe");
#[cfg(all(windows, target_arch = "x86"))]
const LAUNCHER_I686_CONSOLE: &[u8] =
include_bytes!("../../uv-trampoline/trampolines/uv-trampoline-i686-console.exe");
#[cfg(all(windows, target_arch = "x86_64"))]
const LAUNCHER_X86_64_GUI: &[u8] =
include_bytes!("../../uv-trampoline/trampolines/uv-trampoline-x86_64-gui.exe");
@ -161,6 +169,14 @@ pub(crate) fn windows_script_launcher(
}
let launcher_bin: &[u8] = match env::consts::ARCH {
#[cfg(all(windows, target_arch = "x86"))]
"x86" => {
if is_gui {
LAUNCHER_I686_GUI
} else {
LAUNCHER_I686_CONSOLE
}
}
#[cfg(all(windows, target_arch = "x86_64"))]
"x86_64" => {
if is_gui {