[go: nahoru, domu]

blob: b126f4fff0fa31c68576c91c2270d08328bae0ec [file] [log] [blame]
Avi Drissman73a09d12022-09-08 20:33:381# Copyright 2013 The Chromium Authors
sivachandra@chromium.orgec069f72013-08-21 02:44:582# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
sivachandra@chromium.orgec069f72013-08-21 02:44:586import sys
7
8
sivachandra@chromium.orgec069f72013-08-21 02:44:589def IsWindows():
10 return sys.platform in ['win32', 'cygwin']
11
12
sivachandra@chromium.orgec069f72013-08-21 02:44:5813def IsLinux():
krytarowskiec291e2142016-08-09 19:36:2414 return sys.platform.startswith(('linux', 'freebsd', 'netbsd', 'openbsd'))
sivachandra@chromium.orgec069f72013-08-21 02:44:5815
16
sivachandra@chromium.orgec069f72013-08-21 02:44:5817def IsMac():
18 return sys.platform == 'darwin'
19
20
Michael Achenbachd76f98f2018-02-16 22:40:0121def host_os():
22 """
23 Returns a string representing the host_os of the current system.
24 Possible values: 'win', 'mac', 'linux', 'unknown'.
25 """
26 if IsWindows():
27 return 'win'
28 elif IsLinux():
29 return 'linux'
30 elif IsMac():
31 return 'mac'
32 else:
33 return 'unknown'