Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: honor MACOSX_DEPLOYMENT_TARGET #153

Merged
merged 2 commits into from
Sep 29, 2022
Merged
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
30 changes: 20 additions & 10 deletions mesonpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,23 +253,33 @@ def abi_tag(self) -> str:
return selected_tag.abi
return 'none'

@property
@cached_property
def platform_tag(self) -> str:
if self.is_pure:
return 'any'
# XXX: Choose the sysconfig platform here and let something like auditwheel
# fix it later if there are system dependencies (eg. replace it with a manylinux tag)
platform_ = sysconfig.get_platform()
parts = platform_.split('-')
if parts[0] == 'macosx' and parts[1] in ('11', '12'):
# Workaround for bug where pypa/packaging does not consider macOS
# tags without minor versions valid. Some Python flavors (Homebrew
# for example) on macOS started to do this in version 11, and
# pypa/packaging should handle things correctly from version 13 and
# forward, so we will add a 0 minor version to MacOS 11 and 12.
# https://github.com/FFY00/meson-python/issues/91
# https://github.com/pypa/packaging/issues/578
parts[1] += '.0'
if parts[0] == 'macosx':
target = os.environ.get('MACOSX_DEPLOYMENT_TARGET')
if target:
print(
'{yellow}MACOSX_DEPLOYMENT_TARGET is set so we are setting the '
'platform tag to {target}{reset}'.format(target=target, **_STYLES)
)
parts[1] = target

if parts[1] in ('11', '12'):
# Workaround for bug where pypa/packaging does not consider macOS
# tags without minor versions valid. Some Python flavors (Homebrew
# for example) on macOS started to do this in version 11, and
# pypa/packaging should handle things correctly from version 13 and
# forward, so we will add a 0 minor version to MacOS 11 and 12.
# https://github.com/FFY00/meson-python/issues/91
# https://github.com/pypa/packaging/issues/578
parts[1] += '.0'

platform_ = '-'.join(parts)
elif parts[0] == 'linux' and parts[1] == 'x86_64' and sys.maxsize == 0x7fffffff:
# 32-bit Python running on an x86_64 host
Expand Down