feat: set up delvewheel as the default repair wheel command for Windows (#2831)
* Add a default repair wheel command for Windows * Install `delvewheel` into Windows build tools * Add delvewheel to constraints file * Regenerate constraints * Docs * Suggest how to disable Windows wheel repair * Add tests * Run `delvewheel` with verbose mode as default * Add note about telling delvewheel where to look Suggested-by: Nils <nilsnolde@proton.me> * Partially revert 81374bb8fc43acefed76cb13d761a9e6cf6afa58 * Add `pip` and `uv` cases for build installations * Ignore `python-native.dll` for GraalPy * Ignore MSVC DLLs, try Windows amd64 graalpy happy * Fix last remaining Windows test failure (famous last words?) * Update constraints * Drop workaround unneeded with delvewheel v1.12.1 * Update docs/options.md Co-authored-by: Aohan Dang <adang1345@gmail.com> * Drop `test_delvewheel_default_on_windows` * Partially revert "Update constraints" This partially reverts commit 2dc4c0f4951858959e213463d90431a5ca03b96f. * Add a test case when repair command is `""` * Add back test that checks delvewheel run/disable * Add a C project with a missing DLL * Add tests for `missing_dll_project` * Partially undo virtualenv/python-discovery update * Fix test * Discard changes to cibuildwheel/resources/constraints-pyodide312.txt * Discard changes to cibuildwheel/resources/constraints-pyodide314.txt * Fix bad merge of constraints * Discard changes to cibuildwheel/resources/constraints-pyodide313.txt * Manually add more GraalPy pip markers * Dependency parsing was too naïve * Maybe a better way to invoke the compiler on Windows * Can we get away without a DLL? --------- Co-authored-by: Aohan Dang <adang1345@gmail.com>
This commit is contained in:
co-authored by
Aohan Dang
parent
6d9f4c9545
commit
78869d0cf6
@@ -8,6 +8,76 @@ import pytest
|
||||
from . import test_projects, utils
|
||||
|
||||
basic_project = test_projects.new_c_project()
|
||||
missing_dll_project = test_projects.new_c_project_with_missing_dll()
|
||||
|
||||
|
||||
def test_delvewheel_runs_by_default(tmp_path: Path, capfd: pytest.CaptureFixture[str]) -> None:
|
||||
if utils.get_platform() != "windows":
|
||||
pytest.skip("This test is only relevant to Windows")
|
||||
|
||||
skip_if_no_msvc()
|
||||
|
||||
project_dir = tmp_path / "project"
|
||||
basic_project.generate(project_dir)
|
||||
|
||||
utils.cibuildwheel_run(project_dir, add_args=["--archs", "native"], single_python=True)
|
||||
|
||||
captured = capfd.readouterr()
|
||||
assert "Repairing wheel" in captured.out
|
||||
|
||||
|
||||
def test_delvewheel_disabled_by_empty_repair_command(
|
||||
tmp_path: Path, capfd: pytest.CaptureFixture[str]
|
||||
) -> None:
|
||||
if utils.get_platform() != "windows":
|
||||
pytest.skip("This test is only relevant to Windows")
|
||||
|
||||
skip_if_no_msvc()
|
||||
|
||||
project_dir = tmp_path / "project"
|
||||
basic_project.generate(project_dir)
|
||||
|
||||
utils.cibuildwheel_run(
|
||||
project_dir,
|
||||
add_args=["--archs", "native"],
|
||||
add_env={"CIBW_REPAIR_WHEEL_COMMAND_WINDOWS": ""},
|
||||
single_python=True,
|
||||
)
|
||||
|
||||
captured = capfd.readouterr()
|
||||
assert "Repairing wheel" not in captured.out
|
||||
|
||||
|
||||
def test_delvewheel_fails_when_dll_is_missing(tmp_path: Path) -> None:
|
||||
if utils.get_platform() != "windows":
|
||||
pytest.skip("This test is only relevant to Windows")
|
||||
|
||||
skip_if_no_msvc()
|
||||
|
||||
project_dir = tmp_path / "project"
|
||||
missing_dll_project.generate(project_dir)
|
||||
|
||||
with pytest.raises(subprocess.CalledProcessError):
|
||||
utils.cibuildwheel_run(project_dir, add_args=["--archs", "native"], single_python=True)
|
||||
|
||||
|
||||
def test_delvewheel_disabled_allows_build_with_missing_dll(tmp_path: Path) -> None:
|
||||
if utils.get_platform() != "windows":
|
||||
pytest.skip("This test is only relevant to Windows")
|
||||
|
||||
skip_if_no_msvc()
|
||||
|
||||
project_dir = tmp_path / "project"
|
||||
missing_dll_project.generate(project_dir)
|
||||
|
||||
actual_wheels = utils.cibuildwheel_run(
|
||||
project_dir,
|
||||
add_args=["--archs", "native"],
|
||||
add_env={"CIBW_REPAIR_WHEEL_COMMAND_WINDOWS": ""},
|
||||
single_python=True,
|
||||
)
|
||||
|
||||
assert len(actual_wheels) == 1
|
||||
|
||||
|
||||
def skip_if_no_msvc(arm64: bool = False) -> None:
|
||||
|
||||
Reference in New Issue
Block a user