landmine_utils.py 664 B

123456789101112131415161718192021222324252627282930313233
  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. import sys
  5. def IsWindows():
  6. return sys.platform in ['win32', 'cygwin']
  7. def IsLinux():
  8. return sys.platform.startswith(('linux', 'freebsd', 'netbsd', 'openbsd'))
  9. def IsMac():
  10. return sys.platform == 'darwin'
  11. def host_os():
  12. """
  13. Returns a string representing the host_os of the current system.
  14. Possible values: 'win', 'mac', 'linux', 'unknown'.
  15. """
  16. if IsWindows():
  17. return 'win'
  18. elif IsLinux():
  19. return 'linux'
  20. elif IsMac():
  21. return 'mac'
  22. else:
  23. return 'unknown'