Fix recognition of Mac OS X based systems

Previously, Mac OS X was recognized during py2app invocation, as well as runtime
by comparison of os.name with 'macos'.  The value of os.name reports as 'posix'
under more recent version of Python built on Mac OS X.  Now, the recognition is
instead done by comparing sys.platform with 'darwin'.

issue2258
review171004
(transplanted from d2d9d6ec6da433a5d7df4b07e089f21536b9e4fb)
This commit is contained in:
Phillip Heller committed 2011-11-23 20:42:04 -05:00
1 parent dd08d6d9b6
commit 68258ec233
6 files changed
+10 -18

No files matched your search

+2 -4
View File
@@ -89,8 +89,7 @@ if os.name == 'nt':
args['windows'][0]['other_resources'] = [(24, 1, manifest)]
elif os.name == 'mac' \
or (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
elif sys.platform == 'darwin':
import py2app
from modulegraph.find_modules import PY_SUFFIXES
PY_SUFFIXES.append('')
@@ -253,8 +252,7 @@ if os.name == 'nt':
Popen([makensis, "/DVERSION=" + VERSION,
str(os.path.join(os.path.dirname(__file__),
'setup-single.nsi'))]).wait()
elif os.name == 'mac' \
or (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
elif sys.platform == 'darwin':
def find_gtk_dir():
for directory in os.environ['PATH'].split(':'):
if not os.path.isdir(directory):
+1 -2
View File
@@ -376,8 +376,7 @@ def file_open(filename, type, parent, print_p=False):
save_p.close()
file_p.close()
return
elif os.name == 'mac' or \
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
elif sys.platform == 'darwin':
pid = os.fork()
if not pid:
pid = os.fork()
+1 -2
View File
@@ -30,8 +30,7 @@ if not os.path.isdir(get_config_dir()):
def find_path(progs, args):
if os.name == 'nt':
return ''
if os.name == 'mac' or \
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
if sys.platform == 'darwin':
return ''
paths = [x for x in os.environ['PATH'].split(':')
if os.path.isdir(x)]
+2 -3
View File
@@ -87,7 +87,7 @@ class Main(object):
gtk.gdk.CONTROL_MASK)
gtk.accel_map_add_entry('<tryton>/File/Quit', gtk.keysyms.Q,
gtk.gdk.CONTROL_MASK)
if os.name != 'mac':
if sys.platform != 'darwin':
gtk.accel_map_add_entry('<tryton>/User/Menu Reload', gtk.keysyms.T,
gtk.gdk.MOD1_MASK)
gtk.accel_map_add_entry('<tryton>/User/Menu Toggle', gtk.keysyms.T,
@@ -191,8 +191,7 @@ class Main(object):
self.sig_toolbar_show()
self.sig_statusbar_show()
if os.name in ('nt', 'mac') or \
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
if os.name == 'nt' or sys.platform == 'darwin':
# Disable actions, on win32 we use os.startfile
# and on mac we use /usr/bin/open
self.menuitem_actions.set_sensitive(False)
+2 -5
View File
@@ -351,9 +351,7 @@ class ViewList(ParserView):
elif self.widget_tree.sequence:
dnd = True
# Disable DnD on mac until it is fully supported
if os.name == 'mac':
dnd = False
elif hasattr(os, 'uname') and os.uname()[0] == 'Darwin':
if sys.platform == 'darwin':
dnd = False
if screen.readonly:
dnd = False
@@ -480,8 +478,7 @@ class ViewList(ParserView):
# Don't use set_with_data on mac see:
# http://bugzilla.gnome.org/show_bug.cgi?id=508601
if selection.count_selected_rows() < 100 \
or os.name == 'mac' \
or (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
or sys.platform == 'darwin':
data = []
selection.selected_foreach(self.copy_foreach, data)
clipboard.set_text('\n'.join(data))
+2 -2
View File
@@ -8,6 +8,7 @@ from version import PACKAGE
from tryton.client import CURRENT_DIR, PREFIX
import logging
import gtk
import sys
_ = gettext.gettext
@@ -169,8 +170,7 @@ def setlang(lang=None, locale_dict=None):
lang2 = lang
if os.name == 'nt':
lang2 = _LOCALE2WIN32.get(lang, lang)
elif os.name == 'mac' or \
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
elif sys.platform == 'darwin':
encoding = 'UTF-8'
# ensure environment variable are str
lang, lang2, encoding = str(lang), str(lang2), str(encoding)