Skip to content

Commit

Permalink
Improve error message for when a MacOS target version is not met
Browse files Browse the repository at this point in the history
Closes #211
  • Loading branch information
HexDecimal committed Mar 26, 2024
1 parent 526cc49 commit 1602bfd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ rules on making a good Changelog.

## [Unreleased]

### Changed

- Improved error message for when a MacOS target version is not met.
[#211](https://github.com/matthew-brett/delocate/issues/211)

## [0.11.0] - 2024-03-22

### Added
Expand Down
7 changes: 7 additions & 0 deletions delocate/delocating.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,10 +836,17 @@ def _check_and_update_wheel_name(
f"{lib_path} has a minimum target of {lib_macos_version}"
for lib_path, lib_macos_version in problematic_files
)
min_valid_version = max(
lib_macos_version for _, lib_macos_version in problematic_files
)
raise DelocationError(
"Library dependencies do not satisfy target MacOS"
f" version {require_target_macos_version}:\n"
f"{problematic_files_str}"
f"\nUse '--require-target-macos-version {min_valid_version}'"
" or set the environment variable"
f" 'MACOSX_DEPLOYMENT_TARGET={min_valid_version}'"
" to update this wheels supported version."
)
if new_name != wheel_name:
wheel_path = wheel_path.parent / new_name
Expand Down
4 changes: 4 additions & 0 deletions delocate/tests/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,8 @@ def test_delocate_wheel_verify_name_universal2_verify_crash(
assert result.returncode != 0
assert "Library dependencies do not satisfy target MacOS" in result.stderr
assert "libam1.dylib has a minimum target of 12.0" in result.stderr
assert "MACOSX_DEPLOYMENT_TARGET=12.0" in result.stderr
assert "--require-target-macos-version 12.0" in result.stderr


@pytest.mark.xfail( # type: ignore[misc]
Expand Down Expand Up @@ -833,3 +835,5 @@ def test_delocate_wheel_verify_name_universal2_verify_crash_env_var(
assert "Library dependencies do not satisfy target MacOS" in result.stderr
assert "libam1.dylib has a minimum target of 12.0" in result.stderr
assert "module2.abi3.so has a minimum target of 11.0" not in result.stderr
assert "MACOSX_DEPLOYMENT_TARGET=12.0" in result.stderr
assert "--require-target-macos-version 12.0" in result.stderr

0 comments on commit 1602bfd

Please sign in to comment.