Skip to content

Commit 5f8d06f

Browse files
mayeutjoerick
andauthored
feat: initial support for riscv64 (#2366)
* feat: initial support for riscv64 * use enable for riscv64 * Apply review suggestion Co-authored-by: Joe Rickerby <[email protected]> * update documentation --------- Co-authored-by: Joe Rickerby <[email protected]>
1 parent 0463d26 commit 5f8d06f

18 files changed

+139
-26
lines changed

bin/generate_schema.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- cpython-freethreading
3232
- cpython-prerelease
3333
- pypy
34+
- cpython-experimental-riscv64
3435
description: A Python version or flavor to enable.
3536
additionalProperties: false
3637
description: cibuildwheel's settings.
@@ -157,6 +158,9 @@
157158
manylinux-pypy_x86_64-image:
158159
type: string
159160
description: Specify alternative manylinux / musllinux container images
161+
manylinux-riscv64-image:
162+
type: string
163+
description: Specify alternative manylinux / musllinux container images
160164
manylinux-s390x-image:
161165
type: string
162166
description: Specify alternative manylinux / musllinux container images
@@ -175,6 +179,9 @@
175179
musllinux-ppc64le-image:
176180
type: string
177181
description: Specify alternative manylinux / musllinux container images
182+
musllinux-riscv64-image:
183+
type: string
184+
description: Specify alternative manylinux / musllinux container images
178185
musllinux-s390x-image:
179186
type: string
180187
description: Specify alternative manylinux / musllinux container images

bin/update_docker.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,8 @@ def __init__(self, manylinux_version: str, platforms: list[str], tag: str | None
116116
suffix = f"_{platform.removeprefix('pypy_')}"
117117
config[platform][image.manylinux_version] = f"{image.image_name}{suffix}:{tag_name}"
118118

119+
if not config.has_section("riscv64"):
120+
config["riscv64"] = {}
121+
119122
with open(RESOURCES / "pinned_docker_images.cfg", "w") as f:
120123
config.write(f)

cibuildwheel/architecture.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class Architecture(StrEnum):
5151
ppc64le = auto()
5252
s390x = auto()
5353
armv7l = auto()
54+
riscv64 = auto()
5455

5556
# mac archs
5657
universal2 = auto()
@@ -167,6 +168,7 @@ def all_archs(platform: PlatformName) -> "set[Architecture]":
167168
Architecture.ppc64le,
168169
Architecture.s390x,
169170
Architecture.armv7l,
171+
Architecture.riscv64,
170172
},
171173
"macos": {Architecture.x86_64, Architecture.arm64, Architecture.universal2},
172174
"windows": {Architecture.x86, Architecture.AMD64, Architecture.ARM64},

cibuildwheel/logger.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
"manylinux_ppc64le": "manylinux ppc64le",
2323
"manylinux_s390x": "manylinux s390x",
2424
"manylinux_armv7l": "manylinux armv7l",
25+
"manylinux_riscv64": "manylinux riscv64",
2526
"musllinux_x86_64": "musllinux x86_64",
2627
"musllinux_i686": "musllinux i686",
2728
"musllinux_aarch64": "musllinux aarch64",
2829
"musllinux_ppc64le": "musllinux ppc64le",
2930
"musllinux_s390x": "musllinux s390x",
3031
"musllinux_armv7l": "musllinux armv7l",
32+
"musllinux_riscv64": "musllinux riscv64",
3133
"win32": "Windows 32bit",
3234
"win_amd64": "Windows 64bit",
3335
"win_arm64": "Windows on ARM 64bit",

cibuildwheel/oci_container.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class OCIPlatform(Enum):
3333
ARMV7 = "linux/arm/v7"
3434
ARM64 = "linux/arm64"
3535
PPC64LE = "linux/ppc64le"
36+
RISCV64 = "linux/riscv64"
3637
S390X = "linux/s390x"
3738

3839

cibuildwheel/options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"ppc64le",
3636
"s390x",
3737
"armv7l",
38+
"riscv64",
3839
"pypy_aarch64",
3940
"pypy_i686",
4041
)
@@ -46,6 +47,7 @@
4647
"ppc64le",
4748
"s390x",
4849
"armv7l",
50+
"riscv64",
4951
)
5052

5153

cibuildwheel/platforms/linux.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
Architecture.ppc64le: OCIPlatform.PPC64LE,
2929
Architecture.s390x: OCIPlatform.S390X,
3030
Architecture.armv7l: OCIPlatform.ARMV7,
31+
Architecture.riscv64: OCIPlatform.RISCV64,
3132
}
3233

3334

cibuildwheel/resources/build-platforms.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ python_configurations = [
4646
{ identifier = "cp312-manylinux_armv7l", version = "3.12", path_str = "/opt/python/cp312-cp312" },
4747
{ identifier = "cp313-manylinux_armv7l", version = "3.13", path_str = "/opt/python/cp313-cp313" },
4848
{ identifier = "cp313t-manylinux_armv7l", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
49+
{ identifier = "cp38-manylinux_riscv64", version = "3.8", path_str = "/opt/python/cp38-cp38" },
50+
{ identifier = "cp39-manylinux_riscv64", version = "3.9", path_str = "/opt/python/cp39-cp39" },
51+
{ identifier = "cp310-manylinux_riscv64", version = "3.10", path_str = "/opt/python/cp310-cp310" },
52+
{ identifier = "cp311-manylinux_riscv64", version = "3.11", path_str = "/opt/python/cp311-cp311" },
53+
{ identifier = "cp312-manylinux_riscv64", version = "3.12", path_str = "/opt/python/cp312-cp312" },
54+
{ identifier = "cp313-manylinux_riscv64", version = "3.13", path_str = "/opt/python/cp313-cp313" },
55+
{ identifier = "cp313t-manylinux_riscv64", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
4956
{ identifier = "pp38-manylinux_aarch64", version = "3.8", path_str = "/opt/python/pp38-pypy38_pp73" },
5057
{ identifier = "pp39-manylinux_aarch64", version = "3.9", path_str = "/opt/python/pp39-pypy39_pp73" },
5158
{ identifier = "pp310-manylinux_aarch64", version = "3.10", path_str = "/opt/python/pp310-pypy310_pp73" },
@@ -96,6 +103,13 @@ python_configurations = [
96103
{ identifier = "cp312-musllinux_armv7l", version = "3.12", path_str = "/opt/python/cp312-cp312" },
97104
{ identifier = "cp313-musllinux_armv7l", version = "3.13", path_str = "/opt/python/cp313-cp313" },
98105
{ identifier = "cp313t-musllinux_armv7l", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
106+
{ identifier = "cp38-musllinux_riscv64", version = "3.8", path_str = "/opt/python/cp38-cp38" },
107+
{ identifier = "cp39-musllinux_ricv64", version = "3.9", path_str = "/opt/python/cp39-cp39" },
108+
{ identifier = "cp310-musllinux_riscv64", version = "3.10", path_str = "/opt/python/cp310-cp310" },
109+
{ identifier = "cp311-musllinux_riscv64", version = "3.11", path_str = "/opt/python/cp311-cp311" },
110+
{ identifier = "cp312-musllinux_riscv64", version = "3.12", path_str = "/opt/python/cp312-cp312" },
111+
{ identifier = "cp313-musllinux_riscv64", version = "3.13", path_str = "/opt/python/cp313-cp313" },
112+
{ identifier = "cp313t-musllinux_riscv64", version = "3.13", path_str = "/opt/python/cp313-cp313t" },
99113
]
100114

101115
[macos]

cibuildwheel/resources/cibuildwheel.schema.json

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"enum": [
1616
"cpython-freethreading",
1717
"cpython-prerelease",
18-
"pypy"
18+
"pypy",
19+
"cpython-experimental-riscv64"
1920
]
2021
},
2122
"description": "A Python version or flavor to enable."
@@ -357,6 +358,11 @@
357358
"description": "Specify alternative manylinux / musllinux container images",
358359
"title": "CIBW_MANYLINUX_PYPY_X86_64_IMAGE"
359360
},
361+
"manylinux-riscv64-image": {
362+
"type": "string",
363+
"description": "Specify alternative manylinux / musllinux container images",
364+
"title": "CIBW_MANYLINUX_RISCV64_IMAGE"
365+
},
360366
"manylinux-s390x-image": {
361367
"type": "string",
362368
"description": "Specify alternative manylinux / musllinux container images",
@@ -387,6 +393,11 @@
387393
"description": "Specify alternative manylinux / musllinux container images",
388394
"title": "CIBW_MUSLLINUX_PPC64LE_IMAGE"
389395
},
396+
"musllinux-riscv64-image": {
397+
"type": "string",
398+
"description": "Specify alternative manylinux / musllinux container images",
399+
"title": "CIBW_MUSLLINUX_RISCV64_IMAGE"
400+
},
390401
"musllinux-s390x-image": {
391402
"type": "string",
392403
"description": "Specify alternative manylinux / musllinux container images",
@@ -566,6 +577,9 @@
566577
"before-build": {
567578
"$ref": "#/$defs/inherit"
568579
},
580+
"xbuild-tools": {
581+
"$ref": "#/$defs/inherit"
582+
},
569583
"before-test": {
570584
"$ref": "#/$defs/inherit"
571585
},
@@ -581,9 +595,6 @@
581595
"environment-pass": {
582596
"$ref": "#/$defs/inherit"
583597
},
584-
"xbuild-tools": {
585-
"$ref": "#/$defs/inherit"
586-
},
587598
"repair-wheel-command": {
588599
"$ref": "#/$defs/inherit"
589600
},
@@ -652,6 +663,9 @@
652663
"manylinux-pypy_x86_64-image": {
653664
"$ref": "#/properties/manylinux-pypy_x86_64-image"
654665
},
666+
"manylinux-riscv64-image": {
667+
"$ref": "#/properties/manylinux-riscv64-image"
668+
},
655669
"manylinux-s390x-image": {
656670
"$ref": "#/properties/manylinux-s390x-image"
657671
},
@@ -670,12 +684,18 @@
670684
"musllinux-ppc64le-image": {
671685
"$ref": "#/properties/musllinux-ppc64le-image"
672686
},
687+
"musllinux-riscv64-image": {
688+
"$ref": "#/properties/musllinux-riscv64-image"
689+
},
673690
"musllinux-s390x-image": {
674691
"$ref": "#/properties/musllinux-s390x-image"
675692
},
676693
"musllinux-x86_64-image": {
677694
"$ref": "#/properties/musllinux-x86_64-image"
678695
},
696+
"xbuild-tools": {
697+
"$ref": "#/properties/xbuild-tools"
698+
},
679699
"repair-wheel-command": {
680700
"$ref": "#/properties/repair-wheel-command"
681701
},
@@ -752,6 +772,9 @@
752772
"manylinux-pypy_x86_64-image": {
753773
"$ref": "#/properties/manylinux-pypy_x86_64-image"
754774
},
775+
"manylinux-riscv64-image": {
776+
"$ref": "#/properties/manylinux-riscv64-image"
777+
},
755778
"manylinux-s390x-image": {
756779
"$ref": "#/properties/manylinux-s390x-image"
757780
},
@@ -770,12 +793,18 @@
770793
"musllinux-ppc64le-image": {
771794
"$ref": "#/properties/musllinux-ppc64le-image"
772795
},
796+
"musllinux-riscv64-image": {
797+
"$ref": "#/properties/musllinux-riscv64-image"
798+
},
773799
"musllinux-s390x-image": {
774800
"$ref": "#/properties/musllinux-s390x-image"
775801
},
776802
"musllinux-x86_64-image": {
777803
"$ref": "#/properties/musllinux-x86_64-image"
778804
},
805+
"xbuild-tools": {
806+
"$ref": "#/properties/xbuild-tools"
807+
},
779808
"repair-wheel-command": {
780809
"description": "Execute a shell command to repair each built wheel.",
781810
"oneOf": [
@@ -840,6 +869,9 @@
840869
"environment": {
841870
"$ref": "#/properties/environment"
842871
},
872+
"xbuild-tools": {
873+
"$ref": "#/properties/xbuild-tools"
874+
},
843875
"repair-wheel-command": {
844876
"$ref": "#/properties/repair-wheel-command"
845877
},
@@ -891,6 +923,9 @@
891923
"environment": {
892924
"$ref": "#/properties/environment"
893925
},
926+
"xbuild-tools": {
927+
"$ref": "#/properties/xbuild-tools"
928+
},
894929
"repair-wheel-command": {
895930
"description": "Execute a shell command to repair each built wheel.",
896931
"oneOf": [
@@ -955,6 +990,9 @@
955990
"environment": {
956991
"$ref": "#/properties/environment"
957992
},
993+
"xbuild-tools": {
994+
"$ref": "#/properties/xbuild-tools"
995+
},
958996
"repair-wheel-command": {
959997
"$ref": "#/properties/repair-wheel-command"
960998
},
@@ -1006,22 +1044,28 @@
10061044
"environment": {
10071045
"$ref": "#/properties/environment"
10081046
},
1009-
"repair-wheel-command": {
1010-
"$ref": "#/properties/repair-wheel-command"
1011-
},
10121047
"xbuild-tools": {
10131048
"$ref": "#/properties/xbuild-tools"
10141049
},
1050+
"repair-wheel-command": {
1051+
"$ref": "#/properties/repair-wheel-command"
1052+
},
10151053
"test-command": {
10161054
"$ref": "#/properties/test-command"
10171055
},
10181056
"test-extras": {
10191057
"$ref": "#/properties/test-extras"
10201058
},
1059+
"test-sources": {
1060+
"$ref": "#/properties/test-sources"
1061+
},
1062+
"test-groups": {
1063+
"$ref": "#/properties/test-groups"
1064+
},
10211065
"test-requires": {
10221066
"$ref": "#/properties/test-requires"
10231067
}
1024-
}
1068+
}
10251069
}
10261070
}
10271071
}

cibuildwheel/resources/defaults.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ manylinux-aarch64-image = "manylinux_2_28"
3333
manylinux-ppc64le-image = "manylinux_2_28"
3434
manylinux-s390x-image = "manylinux_2_28"
3535
manylinux-armv7l-image = "manylinux_2_31"
36+
manylinux-riscv64-image = "ghcr.io/pypa/cibuildwheel/no_default_image:please_use_override"
3637
manylinux-pypy_x86_64-image = "manylinux_2_28"
3738
manylinux-pypy_i686-image = "manylinux2014"
3839
manylinux-pypy_aarch64-image = "manylinux_2_28"
@@ -43,6 +44,7 @@ musllinux-aarch64-image = "musllinux_1_2"
4344
musllinux-ppc64le-image = "musllinux_1_2"
4445
musllinux-s390x-image = "musllinux_1_2"
4546
musllinux-armv7l-image = "musllinux_1_2"
47+
musllinux-riscv64-image = "ghcr.io/pypa/cibuildwheel/no_default_image:please_use_override"
4648

4749

4850
[tool.cibuildwheel.linux]

0 commit comments

Comments
 (0)