Skip to content

Commit

Permalink
BUG: allow to overwrite macOS platform tag via _PYTHON_HOST_PLATFORM
Browse files Browse the repository at this point in the history
Use sysconfig.get_platform() instead of platform.mac_ver() to base the
platform tag computation.  The ability to overwrite the value returned
by former via the _PYTHON_HOST_PLATFORM environment variable is used
in macOS extension modules cross-compilation.

See mesonbuild#222 for background.
  • Loading branch information
dnicolodi committed Nov 22, 2022
1 parent dc3aac0 commit 2c87374
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mesonpy/_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def get_abi_tag() -> str:
return abi.replace('.', '_').replace('-', '_')


def _get_macosx_platform_tag() -> str:
ver, x, arch = platform.mac_ver()
def _get_macosx_platform_tag(platform) -> str:
ver, arch = platform.split('-', 1)

# Override the macOS version if one is provided via the
# MACOS_DEPLOYMENT_TARGET environment variable.
Expand Down Expand Up @@ -133,7 +133,7 @@ def _get_macosx_platform_tag() -> str:
def get_platform_tag() -> str:
platform = sysconfig.get_platform()
if platform.startswith('macosx'):
return _get_macosx_platform_tag()
return _get_macosx_platform_tag(platform)
if _32_BIT_INTERPRETER:
# 32-bit Python running on a 64-bit kernel.
if platform == 'linux-x86_64':
Expand Down

0 comments on commit 2c87374

Please sign in to comment.