Add --python-platform riscv64-unknown-linux to various commands (#15630)

## Summary

We (and I'm sure many others) are currently doing a lot of RISC-V work
in QEMU. It is possible to significantly improve the speed of
Python-related builds by taking care of the environment setup using an
AMD64 `uv` binary (bypassing binfmt/qemu-system emulation).

Some approx numbers from local testing in riscv64 Ubuntu in QEMU:

| Resolver arch | Command | Time |
| --- | --- | --- |
| riscv64 | `pip install --upgrade --break-system-packages
--index-url=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
openai-harmony` | 15s |
| riscv64 | `uv pip install --upgrade --system --break-system-packages
--index-url=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
openai-harmony` | 5s |
| amd64 | `uv pip install --python-platform=riscv64-unknown-linux
--upgrade --system --break-system-packages
--index-url=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
openai-harmony` | 4s |

The numbers from some larger internal packages with deeper dependency
trees are much more pronounced - 3m6 vs 43s vs 8s, in one example.

Manylinux 2.39 is specified, as it's the first (only?) RISC-V manylinux

## Test Plan

Locally, in QEMU.

`$ docker run --platform linux/riscv64 -it ubuntu:latest`, get amd64
libc into LD_LIBRARY_PATH, tests as above
This commit is contained in:
Jo Shields 2025-09-02 13:17:30 -04:00 committed by GitHub
parent 35ce8e1dae
commit f76e0fe5e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 0 deletions

View file

@ -78,6 +78,11 @@ pub enum TargetTriple {
#[serde(alias = "x8664-unknown-linux-musl")]
X8664UnknownLinuxMusl,
/// A RISCV64 Linux target.
#[cfg_attr(feature = "clap", value(name = "riscv64-unknown-linux"))]
#[serde(rename = "riscv64-unknown-linux")]
Riscv64UnknownLinuxGnu,
/// An `x86_64` target for the `manylinux2014` platform. Equivalent to `x86_64-manylinux_2_17`.
#[cfg_attr(feature = "clap", value(name = "x86_64-manylinux2014"))]
#[serde(rename = "x86_64-manylinux2014")]
@ -273,6 +278,13 @@ impl TargetTriple {
},
Arch::Aarch64,
),
Self::Riscv64UnknownLinuxGnu => Platform::new(
Os::Manylinux {
major: 2,
minor: 39,
},
Arch::Riscv64,
),
Self::Aarch64UnknownLinuxMusl => {
Platform::new(Os::Musllinux { major: 1, minor: 2 }, Arch::Aarch64)
}
@ -483,6 +495,7 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "aarch64",
Self::Aarch64UnknownLinuxMusl => "aarch64",
Self::X8664UnknownLinuxMusl => "x86_64",
Self::Riscv64UnknownLinuxGnu => "riscv64",
Self::X8664Manylinux2014 => "x86_64",
Self::X8664Manylinux217 => "x86_64",
Self::X8664Manylinux228 => "x86_64",
@ -525,6 +538,7 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "Linux",
Self::Aarch64UnknownLinuxMusl => "Linux",
Self::X8664UnknownLinuxMusl => "Linux",
Self::Riscv64UnknownLinuxGnu => "Linux",
Self::X8664Manylinux2014 => "Linux",
Self::X8664Manylinux217 => "Linux",
Self::X8664Manylinux228 => "Linux",
@ -567,6 +581,7 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "",
Self::Aarch64UnknownLinuxMusl => "",
Self::X8664UnknownLinuxMusl => "",
Self::Riscv64UnknownLinuxGnu => "",
Self::X8664Manylinux2014 => "",
Self::X8664Manylinux217 => "",
Self::X8664Manylinux228 => "",
@ -612,6 +627,7 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "",
Self::Aarch64UnknownLinuxMusl => "",
Self::X8664UnknownLinuxMusl => "",
Self::Riscv64UnknownLinuxGnu => "",
Self::X8664Manylinux2014 => "",
Self::X8664Manylinux217 => "",
Self::X8664Manylinux228 => "",
@ -656,6 +672,7 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "posix",
Self::Aarch64UnknownLinuxMusl => "posix",
Self::X8664UnknownLinuxMusl => "posix",
Self::Riscv64UnknownLinuxGnu => "posix",
Self::X8664Manylinux2014 => "posix",
Self::X8664Manylinux217 => "posix",
Self::X8664Manylinux228 => "posix",
@ -698,6 +715,7 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => "linux",
Self::Aarch64UnknownLinuxMusl => "linux",
Self::X8664UnknownLinuxMusl => "linux",
Self::Riscv64UnknownLinuxGnu => "linux",
Self::X8664Manylinux2014 => "linux",
Self::X8664Manylinux217 => "linux",
Self::X8664Manylinux228 => "linux",
@ -740,6 +758,7 @@ impl TargetTriple {
Self::Aarch64UnknownLinuxGnu => true,
Self::Aarch64UnknownLinuxMusl => true,
Self::X8664UnknownLinuxMusl => true,
Self::Riscv64UnknownLinuxGnu => true,
Self::X8664Manylinux2014 => true,
Self::X8664Manylinux217 => true,
Self::X8664Manylinux228 => true,

View file

@ -251,6 +251,7 @@ used.</p>
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>
@ -1243,6 +1244,7 @@ environment in the project.</p>
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>
@ -1843,6 +1845,7 @@ interpreter. Use <code>--universal</code> to display the tree for all platforms,
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>
@ -2167,6 +2170,7 @@ uv tool run [OPTIONS] [COMMAND]
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>
@ -2386,6 +2390,7 @@ uv tool install [OPTIONS] <PACKAGE>
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>
@ -2596,6 +2601,7 @@ Use with <code>--all</code> to apply to all tools.</p>
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>
@ -3834,6 +3840,7 @@ by <code>--python-version</code>.</p>
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>
@ -4105,6 +4112,7 @@ be used with caution, as it can modify the system Python installation.</p>
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>
@ -4394,6 +4402,7 @@ should be used with caution, as it can modify the system Python installation.</p
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>
@ -5023,6 +5032,7 @@ Python environment if no virtual environment is found.</p>
<li><code>aarch64-unknown-linux-gnu</code>: An ARM64 Linux target. Equivalent to <code>aarch64-manylinux_2_28</code></li>
<li><code>aarch64-unknown-linux-musl</code>: An ARM64 Linux target</li>
<li><code>x86_64-unknown-linux-musl</code>: An <code>x86_64</code> Linux target</li>
<li><code>riscv64-unknown-linux</code>: A RISCV64 Linux target</li>
<li><code>x86_64-manylinux2014</code>: An <code>x86_64</code> target for the <code>manylinux2014</code> platform. Equivalent to <code>x86_64-manylinux_2_17</code></li>
<li><code>x86_64-manylinux_2_17</code>: An <code>x86_64</code> target for the <code>manylinux_2_17</code> platform</li>
<li><code>x86_64-manylinux_2_28</code>: An <code>x86_64</code> target for the <code>manylinux_2_28</code> platform</li>

5
uv.schema.json generated
View file

@ -2291,6 +2291,11 @@
"type": "string",
"const": "x86_64-unknown-linux-musl"
},
{
"description": "A RISCV64 Linux target.",
"type": "string",
"const": "riscv64-unknown-linux"
},
{
"description": "An `x86_64` target for the `manylinux2014` platform. Equivalent to `x86_64-manylinux_2_17`.",
"type": "string",