Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 45 additions & 18 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1446,8 +1446,11 @@ pub struct PipCompileArgs {
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aarch64-apple-darwin`.
///
/// When targeting macOS (Darwin), the default minimum version is `12.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `13.0`.
/// When targeting macOS (Darwin), the default minimum version is `13.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting iOS, the default minimum version is `13.0`. Use
/// `IPHONEOS_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting Android, the default minimum Android API level is `24`. Use
/// `ANDROID_API_LEVEL` to specify a different minimum version, e.g., `26`.
Expand Down Expand Up @@ -1775,8 +1778,11 @@ pub struct PipSyncArgs {
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aarch64-apple-darwin`.
///
/// When targeting macOS (Darwin), the default minimum version is `12.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `13.0`.
/// When targeting macOS (Darwin), the default minimum version is `13.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting iOS, the default minimum version is `13.0`. Use
/// `IPHONEOS_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting Android, the default minimum Android API level is `24`. Use
/// `ANDROID_API_LEVEL` to specify a different minimum version, e.g., `26`.
Expand Down Expand Up @@ -2081,8 +2087,11 @@ pub struct PipInstallArgs {
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aarch64-apple-darwin`.
///
/// When targeting macOS (Darwin), the default minimum version is `12.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `13.0`.
/// When targeting macOS (Darwin), the default minimum version is `13.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting iOS, the default minimum version is `13.0`. Use
/// `IPHONEOS_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting Android, the default minimum Android API level is `24`. Use
/// `ANDROID_API_LEVEL` to specify a different minimum version, e.g., `26`.
Expand Down Expand Up @@ -2407,8 +2416,11 @@ pub struct PipCheckArgs {
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aarch64-apple-darwin`.
///
/// When targeting macOS (Darwin), the default minimum version is `12.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `13.0`.
/// When targeting macOS (Darwin), the default minimum version is `13.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting iOS, the default minimum version is `13.0`. Use
/// `IPHONEOS_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting Android, the default minimum Android API level is `24`. Use
/// `ANDROID_API_LEVEL` to specify a different minimum version, e.g., `26`.
Expand Down Expand Up @@ -3335,8 +3347,11 @@ pub struct RunArgs {
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aarch64-apple-darwin`.
///
/// When targeting macOS (Darwin), the default minimum version is `12.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `13.0`.
/// When targeting macOS (Darwin), the default minimum version is `13.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting iOS, the default minimum version is `13.0`. Use
/// `IPHONEOS_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting Android, the default minimum Android API level is `24`. Use
/// `ANDROID_API_LEVEL` to specify a different minimum version, e.g., `26`.
Expand Down Expand Up @@ -3615,8 +3630,11 @@ pub struct SyncArgs {
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aarch64-apple-darwin`.
///
/// When targeting macOS (Darwin), the default minimum version is `12.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `13.0`.
/// When targeting macOS (Darwin), the default minimum version is `13.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting iOS, the default minimum version is `13.0`. Use
/// `IPHONEOS_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting Android, the default minimum Android API level is `24`. Use
/// `ANDROID_API_LEVEL` to specify a different minimum version, e.g., `26`.
Expand Down Expand Up @@ -4641,8 +4659,11 @@ pub struct ToolRunArgs {
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aarch64-apple-darwin`.
///
/// When targeting macOS (Darwin), the default minimum version is `12.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `13.0`.
/// When targeting macOS (Darwin), the default minimum version is `13.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting iOS, the default minimum version is `13.0`. Use
/// `IPHONEOS_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting Android, the default minimum Android API level is `24`. Use
/// `ANDROID_API_LEVEL` to specify a different minimum version, e.g., `26`.
Expand Down Expand Up @@ -4766,8 +4787,11 @@ pub struct ToolInstallArgs {
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aarch64-apple-darwin`.
///
/// When targeting macOS (Darwin), the default minimum version is `12.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `13.0`.
/// When targeting macOS (Darwin), the default minimum version is `13.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting iOS, the default minimum version is `13.0`. Use
/// `IPHONEOS_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting Android, the default minimum Android API level is `24`. Use
/// `ANDROID_API_LEVEL` to specify a different minimum version, e.g., `26`.
Expand Down Expand Up @@ -4866,8 +4890,11 @@ pub struct ToolUpgradeArgs {
/// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or
/// `aarch64-apple-darwin`.
///
/// When targeting macOS (Darwin), the default minimum version is `12.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `13.0`.
/// When targeting macOS (Darwin), the default minimum version is `13.0`. Use
/// `MACOSX_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting iOS, the default minimum version is `13.0`. Use
/// `IPHONEOS_DEPLOYMENT_TARGET` to specify a different minimum version, e.g., `14.0`.
///
/// When targeting Android, the default minimum Android API level is `24`. Use
/// `ANDROID_API_LEVEL` to specify a different minimum version, e.g., `26`.
Expand Down
101 changes: 101 additions & 0 deletions crates/uv-configuration/src/target_triple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,30 @@ pub enum TargetTriple {
/// A wasm32 target using the Pyodide 2024 platform. Meant for use with Python 3.12.
#[cfg_attr(feature = "clap", value(name = "wasm32-pyodide2024"))]
Wasm32Pyodide2024,

/// An ARM64 target for iOS device
///
/// By default, iOS 13.0 is used, but respects the `IPHONEOS_DEPLOYMENT_TARGET`
/// environment variable if set.
#[cfg_attr(feature = "clap", value(name = "arm64-apple-ios"))]
#[serde(rename = "arm64-apple-ios")]
Arm64Ios,

/// An ARM64 target for iOS simulator
///
/// By default, iOS 13.0 is used, but respects the `IPHONEOS_DEPLOYMENT_TARGET`
/// environment variable if set.
#[cfg_attr(feature = "clap", value(name = "arm64-apple-ios-simulator"))]
#[serde(rename = "arm64-apple-ios-simulator")]
Arm64IosSimulator,

/// An `x86_64` target for iOS simulator
///
/// By default, iOS 13.0 is used, but respects the `IPHONEOS_DEPLOYMENT_TARGET`
/// environment variable if set.
#[cfg_attr(feature = "clap", value(name = "x86_64-apple-ios-simulator"))]
#[serde(rename = "x86_64-apple-ios-simulator")]
X8664IosSimulator,
}

impl TargetTriple {
Expand Down Expand Up @@ -510,6 +534,48 @@ impl TargetTriple {
});
Platform::new(Os::Android { api_level }, Arch::X86_64)
}
Self::Arm64Ios => {
let (major, minor) = ios_deployment_target().map_or((13, 0), |(major, minor)| {
debug!("Found iOS deployment target: {}.{}", major, minor);
(major, minor)
});
Platform::new(
Os::Ios {
major,
minor,
simulator: false,
},
Arch::Aarch64,
)
}
Self::Arm64IosSimulator => {
let (major, minor) = ios_deployment_target().map_or((13, 0), |(major, minor)| {
debug!("Found iOS deployment target: {}.{}", major, minor);
(major, minor)
});
Platform::new(
Os::Ios {
major,
minor,
simulator: true,
},
Arch::Aarch64,
)
}
Self::X8664IosSimulator => {
let (major, minor) = ios_deployment_target().map_or((13, 0), |(major, minor)| {
debug!("Found iOS deployment target: {}.{}", major, minor);
(major, minor)
});
Platform::new(
Os::Ios {
major,
minor,
simulator: true,
},
Arch::X86_64,
)
}
}
}

Expand Down Expand Up @@ -555,6 +621,9 @@ impl TargetTriple {
Self::Aarch64LinuxAndroid => "aarch64",
Self::X8664LinuxAndroid => "x86_64",
Self::Wasm32Pyodide2024 => "wasm32",
Self::Arm64Ios => "arm64",
Self::Arm64IosSimulator => "arm64",
Self::X8664IosSimulator => "x86_64",
}
}

Expand Down Expand Up @@ -600,6 +669,9 @@ impl TargetTriple {
Self::Aarch64LinuxAndroid => "Android",
Self::X8664LinuxAndroid => "Android",
Self::Wasm32Pyodide2024 => "Emscripten",
Self::Arm64Ios => "iOS",
Self::Arm64IosSimulator => "iOS",
Self::X8664IosSimulator => "iOS",
}
}

Expand Down Expand Up @@ -648,6 +720,9 @@ impl TargetTriple {
// https://github.com/emscripten-core/emscripten/blob/4.0.8/system/lib/libc/emscripten_syscall_stubs.c#L63
// It doesn't really seem to mean anything? But for completeness we include it here.
Self::Wasm32Pyodide2024 => "#1",
Self::Arm64Ios => "",
Self::Arm64IosSimulator => "",
Self::X8664IosSimulator => "",
}
}

Expand Down Expand Up @@ -695,6 +770,9 @@ impl TargetTriple {
// This is the Emscripten compiler version for Pyodide 2024.
// See https://pyodide.org/en/stable/development/abi.html#pyodide-2024-0
Self::Wasm32Pyodide2024 => "3.1.58",
Self::Arm64Ios => "",
Self::Arm64IosSimulator => "",
Self::X8664IosSimulator => "",
}
}

Expand Down Expand Up @@ -740,6 +818,9 @@ impl TargetTriple {
Self::Aarch64LinuxAndroid => "posix",
Self::X8664LinuxAndroid => "posix",
Self::Wasm32Pyodide2024 => "posix",
Self::Arm64Ios => "posix",
Self::Arm64IosSimulator => "posix",
Self::X8664IosSimulator => "posix",
}
}

Expand Down Expand Up @@ -785,6 +866,9 @@ impl TargetTriple {
Self::Aarch64LinuxAndroid => "android",
Self::X8664LinuxAndroid => "android",
Self::Wasm32Pyodide2024 => "emscripten",
Self::Arm64Ios => "ios",
Self::Arm64IosSimulator => "ios",
Self::X8664IosSimulator => "ios",
}
}

Expand Down Expand Up @@ -830,6 +914,9 @@ impl TargetTriple {
Self::Aarch64LinuxAndroid => false,
Self::X8664LinuxAndroid => false,
Self::Wasm32Pyodide2024 => false,
Self::Arm64Ios => false,
Self::Arm64IosSimulator => false,
Self::X8664IosSimulator => false,
}
}

Expand Down Expand Up @@ -863,6 +950,20 @@ fn macos_deployment_target() -> Option<(u16, u16)> {
Some((major, minor))
}

/// Return the iOS deployment target as parsed from the environment.
fn ios_deployment_target() -> Option<(u16, u16)> {
let version = std::env::var(EnvVars::IPHONEOS_DEPLOYMENT_TARGET).ok()?;
let mut parts = version.split('.');

// Parse the major version (e.g., `12` in `12.0`).
let major = parts.next()?.parse::<u16>().ok()?;

// Parse the minor version (e.g., `0` in `12.0`), with a default of `0`.
let minor = parts.next().unwrap_or("0").parse::<u16>().ok()?;

Some((major, minor))
}

/// Return the Android API level as parsed from the environment.
fn android_api_level() -> Option<u16> {
let api_level_str = std::env::var(EnvVars::ANDROID_API_LEVEL).ok()?;
Expand Down
55 changes: 44 additions & 11 deletions crates/uv-platform-tags/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,50 @@ impl Platform {
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(tag = "name", rename_all = "lowercase")]
pub enum Os {
Manylinux { major: u16, minor: u16 },
Musllinux { major: u16, minor: u16 },
Manylinux {
major: u16,
minor: u16,
},
Musllinux {
major: u16,
minor: u16,
},
Windows,
Pyodide { major: u16, minor: u16 },
Macos { major: u16, minor: u16 },
FreeBsd { release: String },
NetBsd { release: String },
OpenBsd { release: String },
Dragonfly { release: String },
Illumos { release: String, arch: String },
Haiku { release: String },
Android { api_level: u16 },
Pyodide {
major: u16,
minor: u16,
},
Macos {
major: u16,
minor: u16,
},
FreeBsd {
release: String,
},
NetBsd {
release: String,
},
OpenBsd {
release: String,
},
Dragonfly {
release: String,
},
Illumos {
release: String,
arch: String,
},
Haiku {
release: String,
},
Android {
api_level: u16,
},
Ios {
major: u16,
minor: u16,
simulator: bool,
},
}

impl fmt::Display for Os {
Expand All @@ -71,6 +103,7 @@ impl fmt::Display for Os {
Self::Haiku { .. } => write!(f, "haiku"),
Self::Android { .. } => write!(f, "android"),
Self::Pyodide { .. } => write!(f, "pyodide"),
Self::Ios { .. } => write!(f, "ios"),
}
}
}
Expand Down
Loading
Loading