rattler icon indicating copy to clipboard operation
rattler copied to clipboard

Detecting `__osx` virtual package depends on `SYSTEM_VERSION_COMPAT` env var

Open wolfv opened this issue 1 year ago • 2 comments

macOS has weird behavior with the SYSTEM_VERSION_COMPAT env var.

When it is set to 1 the plist file with the system version reports 10.x. When it is 0 it reports 11+ versions.

The conda ecosystem is dependend on 11+ versions nowadays, so that is what we should detect. I think rattler should set this env var before asking for the plist file.

It's not clear wether it's enough to set the env var in the process or if we need to launch a sub-process.

wolfv avatar Oct 01 '24 12:10 wolfv

Corresponding conda issue: https://github.com/conda/conda/issues/13832 (thanks @baszalmstra for pointing this out!)

wolfv avatar Oct 01 '24 12:10 wolfv

This si what some Python packages do (packaging)

    version_str, _, cpu_arch = platform.mac_ver()
    if version is None:
        version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2])))
        if version == (10, 16):
            # When built against an older macOS SDK, Python will report macOS 10.16
            # instead of the real version.
            version_str = subprocess.run(
                [
                    sys.executable,
                    "-sS",
                    "-c",
                    "import platform; print(platform.mac_ver()[0])",
                ],
                check=True,
                env={"SYSTEM_VERSION_COMPAT": "0"},
                stdout=subprocess.PIPE,
                text=True,
            ).stdout
            version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2])))
    else:
        version = version

wolfv avatar Oct 01 '24 12:10 wolfv

We fixed this by rebuilding everything against an 11.0+ SDK. Thanks again to @isuruf for pointing this out! :)

wolfv avatar Oct 08 '24 11:10 wolfv