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

tags: MacOS base_version via dynlib files #288

Open
pradyunsg opened this issue Apr 1, 2020 · 3 comments
Open

tags: MacOS base_version via dynlib files #288

pradyunsg opened this issue Apr 1, 2020 · 3 comments

Comments

@pradyunsg
Copy link
Member

macOS version dectection via pep425tags.py uses any dynlib files to determine the base_version of macOS to support in the wheel (see calculate_macosx_platform_tag. packaging does not seem to have this ability.

Originally posted by @mattip in pypa/wheel#346 (comment)

And this was one of the biggest road blocks to switching to packaging.

Originally posted by @agronholm in pypa/wheel#346 (comment)


This looks like a case of the fork of pep425tags.py in wheel, diverging from the one in pip. Such cases were expected, and (based on a quick skim) I don't see a reason to not add this functionality.

/cc @brettcannon

@Czaki
Copy link

Czaki commented Apr 1, 2020

Hi. I'm author of this code to detect minimum macos version. If there are some questions I can try to explain it.

@pradyunsg
Copy link
Member Author

For reference, the current MacOS-specific platform code in packaging.tags is:

packaging/packaging/tags.py

Lines 389 to 416 in ed0a58f

def mac_platforms(version=None, arch=None):
# type: (Optional[MacVersion], Optional[str]) -> Iterator[str]
"""
Yields the platform tags for a macOS system.
The `version` parameter is a two-item tuple specifying the macOS version to
generate platform tags for. The `arch` parameter is the CPU architecture to
generate platform tags for. Both parameters default to the appropriate value
for the current system.
"""
version_str, _, cpu_arch = platform.mac_ver() # type: ignore
if version is None:
version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2])))
else:
version = version
if arch is None:
arch = _mac_arch(cpu_arch)
else:
arch = arch
for minor_version in range(version[1], -1, -1):
compat_version = version[0], minor_version
binary_formats = _mac_binary_formats(compat_version, arch)
for binary_format in binary_formats:
yield "macosx_{major}_{minor}_{binary_format}".format(
major=compat_version[0],
minor=compat_version[1],
binary_format=binary_format,
)

And the MacOS-specific platform code in wheel's pep425tags.py is:

https://github.com/pypa/wheel/blob/bb33181c3b3558f3bdf8dc4a526a64e2f73bcd96/src/wheel/pep425tags.py#L107-L172

There is significant difference (which is why this is a blocker for wheel) and the corresponding wheel PR is pypa/wheel#314.

@brettcannon
Copy link
Member

Do note that the code in 'wheel' interrogates built files as part of the making of a wheel which we could never do in order to calculate what tags a running interpreter supports.

So while I'm not opposed to incorporating similar code here, it is a shift in what packaging.tags was initially designed around and so the API shift will need handled appropriately as I don't think this is necessarily a drop-in change in the platform detection code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants