Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/news.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Release Notes
=============

**UNRELEASED**

- Fixed the macOS platform-tag warning always using the plural "these files"
wording, even when only a single library required a higher deployment target
(`#697 <https://github.com/pypa/wheel/pull/697>`_)
Comment thread
agronholm marked this conversation as resolved.

**0.48.0 (2026-08-12)**

- Added a ``--local-version`` option to ``wheel pack`` to add, replace, or remove a
Expand Down
4 changes: 2 additions & 2 deletions src/wheel/macosx_libfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,19 +456,19 @@ def calculate_macosx_platform_tag(archive_root: StrPath, platform_tag: str) -> s
fin_base_version = "_".join([str(x) for x in base_version])
if start_version < base_version:
problematic_files = [k for k, v in versions_dict.items() if v > start_version]
problematic_files = "\n".join(problematic_files)
Comment thread
agronholm marked this conversation as resolved.
if len(problematic_files) == 1:
files_form = "this file"
else:
files_form = "these files"
problematic_files_text = "\n".join(problematic_files)
error_message = (
"[WARNING] This wheel needs a higher macOS version than {} "
"To silence this warning, set MACOSX_DEPLOYMENT_TARGET to at least "
+ fin_base_version
+ " or recreate "
+ files_form
+ " with lower "
"MACOSX_DEPLOYMENT_TARGET: \n" + problematic_files
"MACOSX_DEPLOYMENT_TARGET: \n" + problematic_files_text
)

if "MACOSX_DEPLOYMENT_TARGET" in os.environ:
Expand Down
38 changes: 38 additions & 0 deletions tests/test_macosx_libfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from __future__ import annotations

from pathlib import Path

import pytest

from wheel import macosx_libfile
from wheel.macosx_libfile import calculate_macosx_platform_tag


@pytest.mark.parametrize(
("dylib_count", "expected_form"),
[
pytest.param(1, "this file", id="single"),
pytest.param(2, "these files", id="multiple"),
],
)
def test_calculate_macosx_platform_tag_files_form(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture[str],
dylib_count: int,
expected_form: str,
) -> None:
for index in range(dylib_count):
tmp_path.joinpath(f"lib{index}.dylib").touch()

monkeypatch.setattr(
macosx_libfile,
"extract_macosx_min_system_version",
lambda path: (11, 0, 0),
)

tag = calculate_macosx_platform_tag(str(tmp_path), "macosx-10.9-x86_64")

assert tag == "macosx_11_0_x86_64"
warning = capsys.readouterr().err
assert expected_form in warning
Loading