Skip to content

Commit

Permalink
Add alternate manylinux targets to --python-platform (#3229)
Browse files Browse the repository at this point in the history
## Summary

I initially implemented this by allowing arbitrary
`x86_64-manylinux_x_y`, but it makes the Clap, Serde, and Schemars
definitions more complicated, _and_ makes it harder for the user.
Ultimately, manylinux itself only provides images for 2_17 and 2_28, so
this seems like it should be sufficient.

Closes #3222.
  • Loading branch information
charliermarsh authored Apr 24, 2024
1 parent 84989a3 commit 116d47e
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 4 deletions.
72 changes: 70 additions & 2 deletions crates/uv-configuration/src/target_triple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub enum TargetTriple {
#[cfg_attr(feature = "clap", value(name = "x86_64-pc-windows-msvc"))]
X8664PcWindowsMsvc,

/// An x86 Linux target.
/// An x86 Linux target. Equivalent to `x86_64-manylinux_2_17`.
#[cfg_attr(feature = "clap", value(name = "x86_64-unknown-linux-gnu"))]
X8664UnknownLinuxGnu,

Expand All @@ -39,7 +39,7 @@ pub enum TargetTriple {
#[cfg_attr(feature = "clap", value(name = "x86_64-apple-darwin"))]
X8664AppleDarwin,

/// An ARM64 Linux target.
/// An ARM64 Linux target. Equivalent to `aarch64-manylinux_2_17`.
#[cfg_attr(feature = "clap", value(name = "aarch64-unknown-linux-gnu"))]
Aarch64UnknownLinuxGnu,

Expand All @@ -50,6 +50,22 @@ pub enum TargetTriple {
/// An x86_64 Linux target.
#[cfg_attr(feature = "clap", value(name = "x86_64-unknown-linux-musl"))]
X8664UnknownLinuxMusl,

/// An x86_64 target for the `manylinux_2_17` platform.
#[cfg_attr(feature = "clap", value(name = "x86_64-manylinux_2_17"))]
X8664Manylinux217,

/// An x86_64 target for the `manylinux_2_28` platform.
#[cfg_attr(feature = "clap", value(name = "x86_64-manylinux_2_28"))]
X8664Manylinux228,

/// An ARM64 target for the `manylinux_2_17` platform.
#[cfg_attr(feature = "clap", value(name = "aarch64-manylinux_2_17"))]
Aarch64Manylinux217,

/// An ARM64 target for the `manylinux_2_28` platform.
#[cfg_attr(feature = "clap", value(name = "aarch64-manylinux_2_28"))]
Aarch64Manylinux228,
}

impl TargetTriple {
Expand Down Expand Up @@ -91,6 +107,34 @@ impl TargetTriple {
Self::X8664UnknownLinuxMusl => {
Platform::new(Os::Musllinux { major: 1, minor: 2 }, Arch::X86_64)
}
Self::X8664Manylinux217 => Platform::new(
Os::Manylinux {
major: 2,
minor: 17,
},
Arch::X86_64,
),
Self::X8664Manylinux228 => Platform::new(
Os::Manylinux {
major: 2,
minor: 28,
},
Arch::X86_64,
),
Self::Aarch64Manylinux217 => Platform::new(
Os::Manylinux {
major: 2,
minor: 17,
},
Arch::Aarch64,
),
Self::Aarch64Manylinux228 => Platform::new(
Os::Manylinux {
major: 2,
minor: 28,
},
Arch::Aarch64,
),
}
}

Expand All @@ -104,6 +148,10 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "aarch64",
Self::Aarch64UnknownLinuxMusl => "aarch64",
Self::X8664UnknownLinuxMusl => "x86_64",
Self::X8664Manylinux217 => "x86_64",
Self::X8664Manylinux228 => "x86_64",
Self::Aarch64Manylinux217 => "aarch64",
Self::Aarch64Manylinux228 => "aarch64",
}
}

Expand All @@ -117,6 +165,10 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "Linux",
Self::Aarch64UnknownLinuxMusl => "Linux",
Self::X8664UnknownLinuxMusl => "Linux",
Self::X8664Manylinux217 => "Linux",
Self::X8664Manylinux228 => "Linux",
Self::Aarch64Manylinux217 => "Linux",
Self::Aarch64Manylinux228 => "Linux",
}
}

Expand All @@ -130,6 +182,10 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "",
Self::Aarch64UnknownLinuxMusl => "",
Self::X8664UnknownLinuxMusl => "",
Self::X8664Manylinux217 => "",
Self::X8664Manylinux228 => "",
Self::Aarch64Manylinux217 => "",
Self::Aarch64Manylinux228 => "",
}
}

Expand All @@ -143,6 +199,10 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "",
Self::Aarch64UnknownLinuxMusl => "",
Self::X8664UnknownLinuxMusl => "",
Self::X8664Manylinux217 => "",
Self::X8664Manylinux228 => "",
Self::Aarch64Manylinux217 => "",
Self::Aarch64Manylinux228 => "",
}
}

Expand All @@ -156,6 +216,10 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "posix",
Self::Aarch64UnknownLinuxMusl => "posix",
Self::X8664UnknownLinuxMusl => "posix",
Self::X8664Manylinux217 => "posix",
Self::X8664Manylinux228 => "posix",
Self::Aarch64Manylinux217 => "posix",
Self::Aarch64Manylinux228 => "posix",
}
}

Expand All @@ -169,6 +233,10 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "linux",
Self::Aarch64UnknownLinuxMusl => "linux",
Self::X8664UnknownLinuxMusl => "linux",
Self::X8664Manylinux217 => "linux",
Self::X8664Manylinux228 => "linux",
Self::Aarch64Manylinux217 => "linux",
Self::Aarch64Manylinux228 => "linux",
}
}

Expand Down
32 changes: 30 additions & 2 deletions uv.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 116d47e

Please sign in to comment.