From 466052964168ad61efffeb0f811a8694a86b9d86 Mon Sep 17 00:00:00 2001 From: "William D. Jones" Date: Sat, 9 Nov 2024 21:28:38 -0500 Subject: [PATCH] Improve logic for detecting msys2-based Python (works for 3.11 and 3.12). --- src/dep_logic/tags/platform.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dep_logic/tags/platform.py b/src/dep_logic/tags/platform.py index 6e57af5..712b851 100644 --- a/src/dep_logic/tags/platform.py +++ b/src/dep_logic/tags/platform.py @@ -7,7 +7,7 @@ from dataclasses import dataclass from enum import Enum from functools import cached_property -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Optional from . import os @@ -106,18 +106,21 @@ def current(cls) -> Self: platform_ = sysconfig.get_platform() platform_info = platform_.split("-", 1) + architecture: Optional[str] = None if len(platform_info) == 1: if platform_info[0] == "win32": return cls(os.Windows(), Arch.X86) operating_system, _, version_arch = ( platform_.replace(".", "_").replace(" ", "_").partition("_") ) + if version_arch.startswith("x86_64"): + architecture = "x86_64" else: operating_system, version_arch = platform_info if "-" in version_arch: # Ex: macosx-11.2-arm64 version, architecture = version_arch.rsplit("-", 1) - else: + elif not architecture: # Ex: linux-x86_64 version = None architecture = version_arch