Skip to content

Commit

Permalink
update check_host_os
Browse files Browse the repository at this point in the history
  • Loading branch information
anjieyang committed Oct 31, 2024
1 parent 2cc3171 commit 56577e8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions gui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,25 @@
from gui.envs import MAC_ENV, UBUNTU_ENV, WINDOWS_ENV
from gui.host_os import HostOS

_CACHED_HOST_OS = None

def check_host_os() -> HostOS:
# TODO: Check the host OS and return the corresponding HostOS enum
return HostOS.WINDOWS
global _CACHED_HOST_OS

if _CACHED_HOST_OS is None:
import platform
host_os = platform.system().lower()

if host_os == "linux":
_CACHED_HOST_OS = HostOS.LINUX
elif host_os == "darwin":
_CACHED_HOST_OS = HostOS.MAC
elif host_os == "windows":
_CACHED_HOST_OS = HostOS.WINDOWS
else:
raise ValueError(f"Host OS {host_os} is not supported")

return _CACHED_HOST_OS

@evaluator(env_name="ubuntu")
def empty_evaluator_linux() -> bool:
Expand Down

0 comments on commit 56577e8

Please sign in to comment.