feat(toolchains): Add riscv64 linux platform to available toolchain platforms (#1907)
This change adds support for the riscv64 linux platform to rules_python.
It is one of two changes necessary to allow riscv64 linux platforms to
bootstrap modern versions of bazel.
Before this change an attempt to bootstrap bazel would fail with this
error:
```
ERROR: An error occurred during the fetch of repository 'python':
Traceback (most recent call last):
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/c892bce6f2ccb80708b13f24cc8fb67e/external/rules_python/python/private/toolchains_repo.bzl", line 139, column 38, in _toolchain_aliases_impl
host_platform = get_host_platform(os_name, arch)
File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/c892bce6f2ccb80708b13f24cc8fb67e/external/rules_python/python/private/toolchains_repo.bzl", line 298, column 13, in get_host_platform
fail("No platform declared for host OS {} on arch {}".format(os_name, arch))
Error in fail: No platform declared for host OS linux on arch riscv64
```
This change fixes that error.
---------
Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>diff --git a/CHANGELOG.md b/CHANGELOG.md
index 430c5c8..241dce4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -70,10 +70,10 @@
with `extra_pip_args = ["--platform=manylinux_2_4_x86_64"]`, that was an
invalid usage previously but we were not failing the build. From now on this
is explicitly disallowed.
+* (toolchains) Added riscv64 platform definition for python toolchains.
[precompile-docs]: /precompiling
-
## [0.32.2] - 2024-05-14
[0.32.2]: https://github.com/bazelbuild/rules_python/releases/tag/0.32.2
diff --git a/python/versions.bzl b/python/versions.bzl
index b4c837e..08882d3 100644
--- a/python/versions.bzl
+++ b/python/versions.bzl
@@ -536,6 +536,14 @@
# repository_ctx.execute(["uname", "-m"]).stdout.strip()
arch = "ppc64le",
),
+ "riscv64-unknown-linux-gnu": struct(
+ compatible_with = [
+ "@platforms//os:linux",
+ "@platforms//cpu:riscv64",
+ ],
+ os_name = LINUX_NAME,
+ arch = "riscv64",
+ ),
"s390x-unknown-linux-gnu": struct(
compatible_with = [
"@platforms//os:linux",