Add ducktyping test for os.uname

This commit is contained in:
Cédric Krier committed 2008-10-23 14:14:52 +02:00
1 parent 476164b7c6
commit a5fb198350
3 files changed
+6 -3

No files matched your search

+2 -1
View File
@@ -265,7 +265,8 @@ def file_open(filename, type, parent, print_p=False):
# Try without operation, it is not supported on version < 2.5
os.startfile(os.path.normpath(filename))
return
elif os.name == 'mac' or os.uname()[0] == 'Darwin':
elif os.name == 'mac' or \
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
pid = os.fork()
if not pid:
pid = os.fork()
+2 -1
View File
@@ -183,7 +183,8 @@ class Main(object):
self.sig_mode()
if os.name in ('nt', 'mac') or os.uname()[0] == 'Darwin':
if os.name in ('nt', 'mac') or \
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
# Disable actions, on win32 we use os.startfile
# and on mac we use /usr/bin/open
self.menuitem_actions.set_sensitive(False)
+2 -1
View File
@@ -169,7 +169,8 @@ def setlang(lang=None, locale_dict=None):
if os.name == 'nt':
lang2 = _LOCALE2WIN32.get(lang, lang)
os.environ['LANG'] = lang
elif os.name == 'mac' or os.uname()[0] == 'Darwin':
elif os.name == 'mac' or \
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
encoding = 'UTF-8'
locale.setlocale(locale.LC_ALL, str(lang2 + '.' + encoding))
except: