Skip to content

Commit 01a3868

Browse files
author
gns
committed
backport: fix: Add linux_riscv64 to _pip_repository_impl
bazel-contrib#2694
1 parent 900b31b commit 01a3868

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

python/private/pypi/requirements_files_by_platform.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ DEFAULT_PLATFORMS = [
2222
"linux_aarch64",
2323
"linux_arm",
2424
"linux_ppc",
25+
"linux_riscv64",
2526
"linux_s390x",
2627
"linux_x86_64",
2728
"osx_aarch64",

python/private/pypi/whl_installer/platform.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Arch(Enum):
4444
ppc = 4
4545
s390x = 5
4646
arm = 6
47+
riscv64 = 7
4748
amd64 = x86_64
4849
arm64 = aarch64
4950
i386 = x86_32
@@ -273,6 +274,8 @@ def platform_machine(self) -> str:
273274
return ""
274275
elif self.arch == Arch.ppc64le:
275276
return "ppc64le"
277+
elif self.arch == Arch.riscv64:
278+
return "riscv64"
276279
elif self.arch == Arch.s390x:
277280
return "s390x"
278281
else:

python/private/pypi/whl_target_platforms.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ _CPU_ALIASES = {
3232
"ppc": "ppc",
3333
"ppc64": "ppc",
3434
"ppc64le": "ppc",
35+
"riscv64": "riscv64",
3536
"s390x": "s390x",
3637
"arm": "arm",
3738
"armv6l": "arm",

tests/pypi/whl_installer/platform_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ def test_can_get_specific_from_string(self):
3434

3535
def test_can_get_all_for_py_version(self):
3636
cp39 = Platform.all(minor_version=9)
37-
self.assertEqual(18, len(cp39), f"Got {cp39}")
37+
self.assertEqual(21, len(cp39), f"Got {cp39}")
3838
self.assertEqual(cp39, Platform.from_string("cp39_*"))
3939

4040
def test_can_get_all_for_os(self):
4141
linuxes = Platform.all(OS.linux, minor_version=9)
42-
self.assertEqual(6, len(linuxes))
42+
self.assertEqual(7, len(linuxes))
4343
self.assertEqual(linuxes, Platform.from_string("cp39_linux_*"))
4444

4545
def test_can_get_all_for_os_for_host_python(self):
4646
linuxes = Platform.all(OS.linux)
47-
self.assertEqual(6, len(linuxes))
47+
self.assertEqual(7, len(linuxes))
4848
self.assertEqual(linuxes, Platform.from_string("linux_*"))
4949

5050
def test_specific_version_specializations(self):

tests/pypi/whl_target_platforms/whl_target_platforms_tests.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def _test_simple(env):
3434
"musllinux_1_1_ppc64le": [
3535
struct(os = "linux", cpu = "ppc", abi = None, target_platform = "linux_ppc", version = (1, 1)),
3636
],
37+
"musllinux_1_2_riscv64": [
38+
struct(os = "linux", cpu = "riscv64", abi = None, target_platform = "linux_riscv64", version = (1, 2)),
39+
],
3740
"win_amd64": [
3841
struct(os = "windows", cpu = "x86_64", abi = None, target_platform = "windows_x86_64", version = (0, 0)),
3942
],
@@ -63,6 +66,9 @@ def _test_with_abi(env):
6366
"musllinux_1_1_ppc64le": [
6467
struct(os = "linux", cpu = "ppc", abi = "cp311", target_platform = "cp311_linux_ppc", version = (1, 1)),
6568
],
69+
"musllinux_1_2_riscv64": [
70+
struct(os = "linux", cpu = "riscv64", abi = "cp311", target_platform = "cp311_linux_riscv64", version = (1, 2)),
71+
],
6672
"win_amd64": [
6773
struct(os = "windows", cpu = "x86_64", abi = "cp311", target_platform = "cp311_windows_x86_64", version = (0, 0)),
6874
],
@@ -93,13 +99,15 @@ def _can_parse_existing_tags(env):
9399
"manylinux2014_i686": 1,
94100
"manylinux2014_ppc64": 1,
95101
"manylinux2014_ppc64le": 1,
102+
"manylinux2014_riscv64": 1,
96103
"manylinux2014_s390x": 1,
97104
"manylinux2014_x86_64": 1,
98105
"manylinux_11_12_aarch64": 1,
99106
"manylinux_11_12_armv7l": 1,
100107
"manylinux_11_12_i686": 1,
101108
"manylinux_11_12_ppc64": 1,
102109
"manylinux_11_12_ppc64le": 1,
110+
"manylinux_11_12_riscv64": 1,
103111
"manylinux_11_12_s390x": 1,
104112
"manylinux_11_12_x86_64": 1,
105113
"manylinux_1_2_aarch64": 1,
@@ -108,6 +116,7 @@ def _can_parse_existing_tags(env):
108116
"musllinux_11_12_armv7l": 1,
109117
"musllinux_11_12_i686": 1,
110118
"musllinux_11_12_ppc64le": 1,
119+
"musllinux_11_12_riscv64": 1,
111120
"musllinux_11_12_s390x": 1,
112121
"musllinux_11_12_x86_64": 1,
113122
"win32": 1,

0 commit comments

Comments
 (0)