2013-08-21 06:44:58 +04:00
|
|
|
# Copyright 2013 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
def IsWindows():
|
|
|
|
return sys.platform in ['win32', 'cygwin']
|
|
|
|
|
|
|
|
|
|
|
|
def IsLinux():
|
2016-08-09 22:36:24 +03:00
|
|
|
return sys.platform.startswith(('linux', 'freebsd', 'netbsd', 'openbsd'))
|
2013-08-21 06:44:58 +04:00
|
|
|
|
|
|
|
|
|
|
|
def IsMac():
|
|
|
|
return sys.platform == 'darwin'
|
|
|
|
|
|
|
|
|
2018-02-17 01:40:01 +03:00
|
|
|
def host_os():
|
|
|
|
"""
|
|
|
|
Returns a string representing the host_os of the current system.
|
|
|
|
Possible values: 'win', 'mac', 'linux', 'unknown'.
|
|
|
|
"""
|
|
|
|
if IsWindows():
|
|
|
|
return 'win'
|
|
|
|
elif IsLinux():
|
|
|
|
return 'linux'
|
|
|
|
elif IsMac():
|
|
|
|
return 'mac'
|
|
|
|
else:
|
|
|
|
return 'unknown'
|