- Cleaner platform distinguishing code.

This commit is contained in:
ccremers 2006-09-21 13:19:22 +00:00
parent 420ea29fc4
commit 1650c6f64b

View File

@ -41,16 +41,34 @@ class Scyther(object):
global bindir global bindir
# Where is my executable? # Where is my executable?
#
# Auto-detect platform and infer executable name from that
#
prefix = os.path.abspath(bindir) prefix = os.path.abspath(bindir)
if sys.platform.startswith('win'): if "linux" in sys.platform:
""" linux """
self.program = os.path.join(prefix,"scyther")
elif "darwin" in sys.platform:
""" OS X """
# Preferably, we test for architecture (PPC/Intel) until we
# know how to build a universal binary
self.program = os.path.join(prefix,"scyther-osx")
elif sys.platform.startswith('win'):
""" Windows """ """ Windows """
# TODO hardcoded for now, bad # TODO hardcoded for now, bad
self.program = os.path.join(prefix,"Scyther.exe") self.program = os.path.join(prefix,"Scyther.exe")
if not os.path.isfile(self.program): if not os.path.isfile(self.program):
print "I can't find the Scyther executable at %s" % (self.program) print "I can't find the Scyther executable at %s" % (self.program)
else: else:
""" Non-windows (linux) """
self.program = os.path.join(prefix,"scyther") """ Unsupported"""
print "ERROR: I'm sorry, the %s platform is unsupported at the moment" % (sys.platform)
sys.exit()
# Init # Init
self.spdl = None self.spdl = None