Fix and clean-up os checking functions

This commit is contained in:
Andrew Resch 2008-10-23 11:27:37 +00:00
parent 759bb8cc5d
commit b83ef477e4
2 changed files with 8 additions and 25 deletions

View File

@ -35,6 +35,7 @@
import os import os
import subprocess import subprocess
import platform
import pkg_resources import pkg_resources
import xdg, xdg.BaseDirectory import xdg, xdg.BaseDirectory
@ -117,18 +118,13 @@ def get_default_download_dir():
def windows_check(): def windows_check():
"""Checks if the current platform is Windows. Returns True if it is Windows """Checks if the current platform is Windows. Returns True if it is Windows
and False if not.""" and False if not."""
import platform return platform.system() in ('Windows', 'Microsoft')
if platform.system() in ('Windows', 'Microsoft'):
return True
else:
return False
def vista_check(): def vista_check():
import platform return platform.release() == "Vista"
if platform.release() == "Vista":
return True def osx_check():
else: return platform.system() == "Darwin"
return False
def get_pixmap(fname): def get_pixmap(fname):
"""Returns a pixmap file included with deluge""" """Returns a pixmap file included with deluge"""
@ -314,9 +310,3 @@ def is_ip(ip):
return True return True
except socket.error: except socket.error:
return False return False
def osx_check():
if platform.system() in ("Darwin"):
return True
else:
return False

View File

@ -45,17 +45,10 @@ import platform
python_version = platform.python_version()[0:3] python_version = platform.python_version()[0:3]
def windows_check(): def windows_check():
import platform return platform.system() in ('Windows', 'Microsoft')
if platform.system() in ('Windows', 'Microsoft'):
return True
else:
return False
def osx_check(): def osx_check():
if platform.system() in ("Darwin"): return platform.system() == "Darwin"
return True
else:
return False
# Try to get SVN revision number to append to version # Try to get SVN revision number to append to version
revision_string = "" revision_string = ""