Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ END_UNRELEASED_TEMPLATE
([#3339](https://github.com/bazel-contrib/rules_python/issues/3339)).
* (uv) {obj}`//python/uv:lock.bzl%lock` now works with a local platform
runtime.
* (pypi) `linux_riscv64` is added to the platforms list in `_pip_repository_impl`,
which fixes [a build issue for tensorflow on riscv64](https://github.com/bazel-contrib/rules_python/discussions/2729).
* (toolchains) WORKSPACE builds now correctly register musl and freethreaded
variants. Setting {obj}`--py_linux_libc=musl` and `--py_freethreaded=yes` now
activate them, respectively.
Expand Down Expand Up @@ -1980,4 +1982,4 @@ Breaking changes:
* (pip) Create all_data_requirements alias
* Expose Python C headers through the toolchain.

[0.24.0]: https://github.com/bazel-contrib/rules_python/releases/tag/0.24.0
[0.24.0]: https://github.com/bazel-contrib/rules_python/releases/tag/0.24.0
1 change: 1 addition & 0 deletions python/private/pypi/pip_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def _pip_repository_impl(rctx):
"linux_aarch64",
"linux_arm",
"linux_ppc",
"linux_riscv64",
"linux_s390x",
"linux_x86_64",
"osx_aarch64",
Expand Down
3 changes: 3 additions & 0 deletions python/private/pypi/whl_installer/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Arch(Enum):
ppc64le = 5
s390x = 6
arm = 7
riscv64 = 8
amd64 = x86_64
arm64 = aarch64
i386 = x86_32
Expand Down Expand Up @@ -269,6 +270,8 @@ def platform_machine(self) -> str:
return "ppc"
elif self.arch == Arch.ppc64le:
return "ppc64le"
elif self.arch == Arch.riscv64:
return "riscv64"
elif self.arch == Arch.s390x:
return "s390x"
else:
Expand Down
1 change: 1 addition & 0 deletions python/private/pypi/whl_target_platforms.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ _CPU_ALIASES = {
"ppc": "ppc",
"ppc64": "ppc",
"ppc64le": "ppc64le",
"riscv64": "riscv64",
"s390x": "s390x",
"arm": "arm",
"armv6l": "arm",
Expand Down
6 changes: 3 additions & 3 deletions tests/pypi/whl_installer/platform_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ def test_can_get_specific_from_string(self):

def test_can_get_all_for_py_version(self):
cp39 = Platform.all(minor_version=9, micro_version=0)
self.assertEqual(21, len(cp39), f"Got {cp39}")
self.assertEqual(24, len(cp39), f"Got {cp39}")
self.assertEqual(cp39, Platform.from_string("cp39.0_*"))

def test_can_get_all_for_os(self):
linuxes = Platform.all(OS.linux, minor_version=9)
self.assertEqual(7, len(linuxes))
self.assertEqual(8, len(linuxes))
self.assertEqual(linuxes, Platform.from_string("cp39_linux_*"))

def test_can_get_all_for_os_for_host_python(self):
linuxes = Platform.all(OS.linux)
self.assertEqual(7, len(linuxes))
self.assertEqual(8, len(linuxes))
self.assertEqual(linuxes, Platform.from_string("linux_*"))

def test_platform_sort(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def _test_simple(env):
"musllinux_1_1_ppc64le": [
struct(os = "linux", cpu = "ppc64le", abi = None, target_platform = "linux_ppc64le", version = (1, 1)),
],
"musllinux_1_2_riscv64": [
struct(os = "linux", cpu = "riscv64", abi = None, target_platform = "linux_riscv64", version = (1, 2)),
],
"win_amd64": [
struct(os = "windows", cpu = "x86_64", abi = None, target_platform = "windows_x86_64", version = (0, 0)),
],
Expand Down Expand Up @@ -66,6 +69,9 @@ def _test_with_abi(env):
"musllinux_1_1_ppc64le": [
struct(os = "linux", cpu = "ppc64le", abi = "cp311", target_platform = "cp311_linux_ppc64le", version = (1, 1)),
],
"musllinux_1_2_riscv64": [
struct(os = "linux", cpu = "riscv64", abi = "cp311", target_platform = "cp311_linux_riscv64", version = (1, 2)),
],
"win_amd64": [
struct(os = "windows", cpu = "x86_64", abi = "cp311", target_platform = "cp311_windows_x86_64", version = (0, 0)),
],
Expand Down Expand Up @@ -96,13 +102,15 @@ def _can_parse_existing_tags(env):
"manylinux2014_i686": 1,
"manylinux2014_ppc64": 1,
"manylinux2014_ppc64le": 1,
"manylinux2014_riscv64": 1,
"manylinux2014_s390x": 1,
"manylinux2014_x86_64": 1,
"manylinux_11_12_aarch64": 1,
"manylinux_11_12_armv7l": 1,
"manylinux_11_12_i686": 1,
"manylinux_11_12_ppc64": 1,
"manylinux_11_12_ppc64le": 1,
"manylinux_11_12_riscv64": 1,
"manylinux_11_12_s390x": 1,
"manylinux_11_12_x86_64": 1,
"manylinux_1_2_aarch64": 1,
Expand All @@ -111,6 +119,7 @@ def _can_parse_existing_tags(env):
"musllinux_11_12_armv7l": 1,
"musllinux_11_12_i686": 1,
"musllinux_11_12_ppc64le": 1,
"musllinux_11_12_riscv64": 1,
"musllinux_11_12_s390x": 1,
"musllinux_11_12_x86_64": 1,
"win32": 1,
Expand Down