From 9ce357ba5925287df6a4c6b4bb7f1267b176fa4f Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Mon, 23 Sep 2024 16:45:34 +0800 Subject: [PATCH] fix: handle unknown platform Signed-off-by: Frost Ming --- src/dep_logic/tags/platform.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dep_logic/tags/platform.py b/src/dep_logic/tags/platform.py index b49a503..6e57af5 100644 --- a/src/dep_logic/tags/platform.py +++ b/src/dep_logic/tags/platform.py @@ -109,10 +109,11 @@ def current(cls) -> Self: if len(platform_info) == 1: if platform_info[0] == "win32": return cls(os.Windows(), Arch.X86) - else: - raise PlatformError(f"Unsupported platform {platform_}") + operating_system, _, version_arch = ( + platform_.replace(".", "_").replace(" ", "_").partition("_") + ) else: - [operating_system, version_arch] = platform_info + operating_system, version_arch = platform_info if "-" in version_arch: # Ex: macosx-11.2-arm64 version, architecture = version_arch.rsplit("-", 1)