Permalink
Browse files

utils: Simplify platform checks

Avoid calling platform.system() since the details we need
are already in `os` and `sys`.

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information...
davvid committed May 21, 2012
1 parent 46a601e commit a58ffbd5e37fc52f7b4607513a83f7a43e784682
Showing with 3 additions and 8 deletions.
  1. +3 −8 cola/utils.py
View
@@ -3,7 +3,6 @@
import mimetypes
import os
-import platform
import random
import re
import shlex
@@ -15,7 +14,6 @@
from cola import core
from cola import resources
from cola.compat import hashlib
-from cola.decorators import memoize
from cola.decorators import interruptable
random.seed(hash(time.time()))
@@ -269,27 +267,24 @@ def tmp_filename(prefix):
return os.path.join(tmp_dir(), basename)
-@interruptable
def is_linux():
"""Is this a linux machine?"""
- return platform.system() == 'Linux'
+ return sys.platform.startswith('linux')
def is_debian():
"""Is it debian?"""
return os.path.exists('/usr/bin/apt-get')
-@interruptable
def is_darwin():
"""Return True on OSX."""
- return platform.system() == 'Darwin'
+ return sys.platform == 'darwin'
-@memoize
def is_win32():
"""Return True on win32"""
- return os.name in ('nt', 'dos')
+ return sys.platform == 'win32' or sys.platform == 'cygwin'
def win32_set_binary(fd):

0 comments on commit a58ffbd

Please sign in to comment.