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

MacOS Platform tag when MACOSX_DEPLOYMENT_TARGET is set #312

Closed
Czaki opened this issue Sep 15, 2019 · 5 comments
Closed

MacOS Platform tag when MACOSX_DEPLOYMENT_TARGET is set #312

Czaki opened this issue Sep 15, 2019 · 5 comments

Comments

@Czaki
Copy link
Contributor

Czaki commented Sep 15, 2019

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
@agronholm
Copy link
Contributor

Would you like to make a PR (with test[s])?

@Czaki
Copy link
Contributor Author

Czaki commented Sep 15, 2019

I can try.

@Czaki
Copy link
Contributor Author

Czaki commented Sep 23, 2019

@agronholm I found other way to achieve this in other way. MacOs library header contains information about minimal system version. I wrote the code which extract this information from file. But I do not know how find information about list of files included to wheel to extract all .dynlib files to analyse it. Could you give me hint?

@agronholm
Copy link
Contributor

Presumably you need to look at the files about to be zipped by bdist_wheel. The archive_root variable contains the base directory that you can look through.

@Czaki
Copy link
Contributor Author

Czaki commented Sep 24, 2019

@agronholm I have created pull request #314

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

2 participants