mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-07 19:20:39 +00:00
Fix mac os arch with platform.mac_ver()
(#2454)
Fixes #2450, see
8280420121
This commit is contained in:
parent
ef22e9bf3f
commit
b5d9014918
2 changed files with 17 additions and 7 deletions
|
@ -4,10 +4,12 @@ Queries information about the current Python interpreter and prints it as JSON.
|
|||
The script will exit with status 0 on known error that are turned into rust errors.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
import json
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
import struct
|
||||
import sysconfig
|
||||
|
||||
|
||||
|
@ -451,13 +453,20 @@ def get_operating_system_and_architecture():
|
|||
"name": "windows",
|
||||
}
|
||||
elif operating_system == "macosx":
|
||||
# GitHub Actions python seems to be doing this.
|
||||
if architecture == "universal2":
|
||||
if platform.processor() == "arm":
|
||||
architecture = "aarch64"
|
||||
# Apparently, Mac OS is reporting i386 sometimes in sysconfig.get_platform even
|
||||
# though that's not a thing anymore.
|
||||
# https://github.com/astral-sh/uv/issues/2450
|
||||
version, _, architecture = platform.mac_ver()
|
||||
|
||||
# https://github.com/pypa/packaging/blob/cc938f984bbbe43c5734b9656c9837ab3a28191f/src/packaging/tags.py#L356-L363
|
||||
is_32bit = struct.calcsize("P") == 4
|
||||
if is_32bit:
|
||||
if architecture.startswith("ppc"):
|
||||
architecture = "ppc"
|
||||
else:
|
||||
architecture = platform.processor()
|
||||
version = platform.mac_ver()[0].split(".")
|
||||
architecture = "i386"
|
||||
|
||||
version = version.split(".")
|
||||
operating_system = {
|
||||
"name": "macos",
|
||||
"major": int(version[0]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue