From f7efb09734b206b7e62bc190bdd9aa90b547026a Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Mon, 6 Jul 2009 09:54:30 +0000 Subject: [PATCH] add platform utility functions svn: r12765 --- src/Utils.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/Utils.py b/src/Utils.py index 1e4cfc014..4ba5ff420 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -47,7 +47,7 @@ import gen.lib import Errors from GrampsLocale import codeset -from const import TEMP_DIR, USER_HOME, WINDOWS +from const import TEMP_DIR, USER_HOME, WINDOWS, MACOS, LINUX from TransUtils import sgettext as _ #------------------------------------------------------------------------- @@ -210,6 +210,37 @@ def family_upper_name(family, db): name = mother.get_primary_name().get_upper_name() return name +#------------------------------------------------------------------------- +# +# Platform determination functions +# +#------------------------------------------------------------------------- + +def lin(): + """ + Return True if a linux system + Note: Normally do as linux in else statement of a check ! + """ + if platform.system() in LINUX: + return True + return False + +def mac(): + """ + Return True if a Macintosh system + """ + if platform.system() in MACOS: + return True + return False + +def win(): + """ + Return True if a windows system + """ + if platform.system() in WINDOWS: + return True + return False + #------------------------------------------------------------------------- # # String Encoding functions