We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2cc3171 commit 56577e8Copy full SHA for 56577e8
gui/utils.py
@@ -27,11 +27,25 @@
27
from gui.envs import MAC_ENV, UBUNTU_ENV, WINDOWS_ENV
28
from gui.host_os import HostOS
29
30
+_CACHED_HOST_OS = None
31
32
def check_host_os() -> HostOS:
- # TODO: Check the host OS and return the corresponding HostOS enum
33
- return HostOS.WINDOWS
+ global _CACHED_HOST_OS
34
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
49
50
@evaluator(env_name="ubuntu")
51
def empty_evaluator_linux() -> bool:
0 commit comments