Skip to content

MacOS Platform tag when MACOSX_DEPLOYMENT_TARGET is set #312

@Czaki

Description

@Czaki

On MacOs., by default Platform Tag is set to Python platform tag version https://docs.python.org/3/distutils/apiref.html#distutils.util.get_platform

But developer can set MACOSX_DEPLOYMENT_TARGET to another version (eg, to use newer API). So can build python package which will not work on MacOs version suggested by platform tag.

Of course it can be overwritten by -p flag, but I think that it should be out of box.

Maybe some change like (https://github.com/pypa/wheel/blob/master/wheel/pep425tags.py):

def get_platform():
    """Return our platform name 'win32', 'linux_x86_64'"""
    # XXX remove distutils dependency
    result = distutils.util.get_platform()
    if result.startswith("macosx-") and "MACOSX_DEPLOYMENT_TARGET" in os.environ:
        result.rfind()
        tag = result[7:result.rfind("-")]
        parsed_tag = tuple(map(int, tag.split(".")))
        parsed_target = tuple(map(int, os.environ["MACOSX_DEPLOYMENT_TARGET"].split(".")))
        if parsed_tag < parsed_target:
            result = "macosx-" + os.environ["MACOSX_DEPLOYMENT_TARGET"] + result[result.rfind('-'):]
    result = result.replace('.', '_').replace('-', '_')
    if result == "linux_x86_64" and sys.maxsize == 2147483647:
        # pip pull request #3497
        result = "linux_i686"
    return result

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions