From 06ef9b51f76e3c7d19b70c2e124e7a5a547e15cf Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 14 Mar 2024 09:58:05 -0500 Subject: [PATCH] Revert " Fix mac os arch with `platform.mac_ver()` (#2454)" This reverts commit b5d90149180ae38de6798a4a857f72fc3d5a64e7. --- crates/platform-tags/src/platform.rs | 1 - .../python/get_interpreter_info.py | 23 ++++++------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/crates/platform-tags/src/platform.rs b/crates/platform-tags/src/platform.rs index f68840c4716b..4e10b44219aa 100644 --- a/crates/platform-tags/src/platform.rs +++ b/crates/platform-tags/src/platform.rs @@ -78,7 +78,6 @@ pub enum Arch { Armv7L, Powerpc64Le, Powerpc64, - #[serde(alias = "i386")] X86, #[serde(alias = "amd64")] X86_64, diff --git a/crates/uv-interpreter/python/get_interpreter_info.py b/crates/uv-interpreter/python/get_interpreter_info.py index a2c1e98ba1f6..485cd95cd0e0 100644 --- a/crates/uv-interpreter/python/get_interpreter_info.py +++ b/crates/uv-interpreter/python/get_interpreter_info.py @@ -4,12 +4,10 @@ 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 struct +import sys import sysconfig @@ -453,20 +451,13 @@ def get_operating_system_and_architecture(): "name": "windows", } elif operating_system == "macosx": - # 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" + # GitHub Actions python seems to be doing this. + if architecture == "universal2": + if platform.processor() == "arm": + architecture = "aarch64" else: - architecture = "i386" - - version = version.split(".") + architecture = platform.processor() + version = platform.mac_ver()[0].split(".") operating_system = { "name": "macos", "major": int(version[0]),