Skip to content

Commit

Permalink
Validate and update macOS platform tag in wheel name (#198)
Browse files Browse the repository at this point in the history
Ensure wheels are compatible with the specified macOS version using `--require-target-macos-version` or `MACOSX_DEPLOYMENT_TARGET`.

Checks the wheel tag and binaries of wheels to determine a more accurate platform tag then enforce accurate results.

Co-authored-by: Kyle Benesch <[email protected]>
  • Loading branch information
Czaki and HexDecimal authored Feb 17, 2024
1 parent eaba43d commit f558485
Show file tree
Hide file tree
Showing 13 changed files with 653 additions and 72 deletions.
13 changes: 13 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ rules on making a good Changelog.

## [Unreleased]

### Added

- Use `--require-target-macos-version` or the `MACOSX_DEPLOYMENT_TARGET`
environment variable to ensure that wheels are
compatible with the specified macOS version. #198

### Changed

- Delocate now uses the binaries of the wheel file to determine a more accurate
platform tag, this will rename wheels accordingly. #198
- `delocate-wheel` is now more strict with platform tags and will no longer allow
a wheel to be incompatible with its own tags. #198

## [0.10.7] - 2023-12-12

### Changed
Expand Down
18 changes: 18 additions & 0 deletions delocate/cmd/delocate_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from os.path import join as pjoin
from typing import List, Optional, Text

from packaging.version import Version

from delocate import delocate_wheel
from delocate.cmd.common import (
common_parser,
Expand Down Expand Up @@ -61,6 +63,12 @@
" (from 'intel', 'i386', 'x86_64', 'i386,x86_64', 'universal2',"
" 'x86_64,arm64')",
)
parser.add_argument(
"--require-target-macos-version",
type=Version,
help="Verify if platform tag in wheel name is proper",
default=None,
)


def main() -> None:
Expand All @@ -82,6 +90,15 @@ def main() -> None:
else:
require_archs = args.require_archs

require_target_macos_version = args.require_target_macos_version
if (
require_target_macos_version is None
and "MACOSX_DEPLOYMENT_TARGET" in os.environ
):
require_target_macos_version = Version(
os.environ["MACOSX_DEPLOYMENT_TARGET"]
)

for wheel in wheels:
if multi or args.verbose:
print("Fixing: " + wheel)
Expand All @@ -94,6 +111,7 @@ def main() -> None:
out_wheel,
lib_sdir=args.lib_sdir,
require_archs=require_archs,
require_target_macos_version=require_target_macos_version,
**delocate_values(args),
)
if args.verbose and len(copied):
Expand Down
Loading

0 comments on commit f558485

Please sign in to comment.