Skip to content

Commit 56577e8

Browse files
committed
update check_host_os
1 parent 2cc3171 commit 56577e8

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

gui/utils.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,25 @@
2727
from gui.envs import MAC_ENV, UBUNTU_ENV, WINDOWS_ENV
2828
from gui.host_os import HostOS
2929

30+
_CACHED_HOST_OS = None
3031

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

35+
if _CACHED_HOST_OS is None:
36+
import platform
37+
host_os = platform.system().lower()
38+
39+
if host_os == "linux":
40+
_CACHED_HOST_OS = HostOS.LINUX
41+
elif host_os == "darwin":
42+
_CACHED_HOST_OS = HostOS.MAC
43+
elif host_os == "windows":
44+
_CACHED_HOST_OS = HostOS.WINDOWS
45+
else:
46+
raise ValueError(f"Host OS {host_os} is not supported")
47+
48+
return _CACHED_HOST_OS
3549

3650
@evaluator(env_name="ubuntu")
3751
def empty_evaluator_linux() -> bool:

0 commit comments

Comments
 (0)