• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2013 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
6import sys
7
8
9def IsWindows():
10  return sys.platform in ['win32', 'cygwin']
11
12
13def IsLinux():
14  return sys.platform.startswith(('linux', 'freebsd', 'netbsd', 'openbsd'))
15
16
17def IsMac():
18  return sys.platform == 'darwin'
19
20
21def 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'
34