Skip to content

Commit

Permalink
TST: reconcile platform tags with recent packaging on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
dnicolodi committed Dec 9, 2022
1 parent d0a8bd4 commit 565bd4a
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import os.path
import pathlib
import platform
import re
import shutil
import subprocess
Expand All @@ -19,13 +20,24 @@


def adjust_packaging_platform_tag(platform: str) -> str:
# The packaging module generates overly specific platforms tags on
# Linux. The platforms tags on Linux evolved over time.
# meson-python uses more relaxed platform tags to maintain
# compatibility with old wheel installation tools. The relaxed
# platform tags match the ones generated by the wheel package.
# https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/
return re.sub(r'^(many|musl)linux(1|2010|2014|_\d+_\d+)_(.*)$', r'linux_\3', platform)
if platform.startswith(('manylinux', 'musllinux')):
# The packaging module generates overly specific platforms tags on
# Linux. The platforms tags on Linux evolved over time.
# meson-python uses more relaxed platform tags to maintain
# compatibility with old wheel installation tools. The relaxed
# platform tags match the ones generated by the wheel package.
# https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/
return re.sub(r'^(many|musl)linux(1|2010|2014|_\d+_\d+)_(.*)$', r'linux_\3', platform)
if platform.startwith('macosx'):
# Python built with older macOS SDK on macOS 11, reports an
# unexising macOS 10.16 version instead of the real version.
# The packaging module introduced a workaround in version
# 22.0. Too maintain compatibility with older packaging
# releases we don't implement it. Reconcile this.
version = tuple(map(int, platform.mac_ver()[0].split('.'))[:2])
if version == (10, 16):
return re.sub(r'^macosx_\d+_\d+_(.*)$', r'macosx_10_16_\1', platform)
return platform


package_dir = pathlib.Path(__file__).parent / 'packages'
Expand Down

0 comments on commit 565bd4a

Please sign in to comment.