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

Improve logic for detecting msys2-based Python (works for 3.11 and 3.… #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/dep_logic/tags/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down