Skip to content

Commit 68c0366

Browse files
authored
feat: add deprecation warning for cpython-experimental-riscv64 enable (#2526)
1 parent 1c38fac commit 68c0366

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

cibuildwheel/__main__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,13 @@ def detect_warnings(*, options: Options) -> Generator[str, None, None]:
417417
build_selector = options.globals.build_selector
418418
test_selector = options.globals.test_selector
419419

420+
if EnableGroup.CPythonExperimentalRiscV64 in build_selector.enable:
421+
yield (
422+
"'cpython-experimental-riscv64' enable is deprecated and will be removed in a future version. "
423+
"It should be removed from tool.cibuildwheel.enable in pyproject.toml "
424+
"or CIBW_ENABLE environment variable."
425+
)
426+
420427
all_valid_identifiers = [
421428
config.identifier
422429
for module in ALL_PLATFORM_MODULES.values()

cibuildwheel/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ def globals(self) -> GlobalOptions:
665665
build_config = args.only
666666
skip_config = ""
667667
architectures = Architecture.all_archs(self.platform)
668-
enable = set(EnableGroup)
668+
enable |= set(EnableGroup) - {EnableGroup.CPythonExperimentalRiscV64}
669669

670670
build_selector = BuildSelector(
671671
build_config=build_config,

unit_test/main_tests/main_options_test.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23
import tomllib
34
from fnmatch import fnmatch
@@ -141,6 +142,52 @@ def test_empty_selector(monkeypatch):
141142
assert e.value.code == 3
142143

143144

145+
@pytest.mark.usefixtures("platform", "intercepted_build_args")
146+
def test_riscv64_warning1(monkeypatch, capsys):
147+
monkeypatch.setenv("CIBW_ENABLE", "cpython-experimental-riscv64")
148+
149+
main()
150+
151+
_, err = capsys.readouterr()
152+
print(err)
153+
assert "'cpython-experimental-riscv64' enable is deprecated" in err
154+
155+
156+
@pytest.mark.usefixtures("platform", "intercepted_build_args")
157+
def test_riscv64_warning2(monkeypatch, capsys, tmp_path):
158+
local_path = tmp_path / "tmp_project"
159+
os.mkdir(local_path) # noqa:PTH102 Path.mkdir has been monkeypatched already
160+
local_path.joinpath("setup.py").touch()
161+
162+
monkeypatch.setattr(
163+
sys, "argv", ["cibuildwheel", "--only", "cp313-manylinux_riscv64", str(local_path)]
164+
)
165+
monkeypatch.setenv("CIBW_ENABLE", "cpython-experimental-riscv64")
166+
167+
main()
168+
169+
_, err = capsys.readouterr()
170+
print(err)
171+
assert "'cpython-experimental-riscv64' enable is deprecated" in err
172+
173+
174+
@pytest.mark.usefixtures("platform", "intercepted_build_args")
175+
def test_riscv64_no_warning(monkeypatch, capsys, tmp_path):
176+
local_path = tmp_path / "tmp_project"
177+
os.mkdir(local_path) # noqa:PTH102 Path.mkdir has been monkeypatched already
178+
local_path.joinpath("setup.py").touch()
179+
180+
monkeypatch.setattr(
181+
sys, "argv", ["cibuildwheel", "--only", "cp313-manylinux_riscv64", str(local_path)]
182+
)
183+
184+
main()
185+
186+
_, err = capsys.readouterr()
187+
print(err)
188+
assert "'cpython-experimental-riscv64' enable is deprecated" not in err
189+
190+
144191
@pytest.mark.parametrize(
145192
("architecture", "image", "full_image"),
146193
[

0 commit comments

Comments
 (0)