From 1650c6f64b0dfdd398b041a35e0be75882e5dee4 Mon Sep 17 00:00:00 2001 From: ccremers Date: Thu, 21 Sep 2006 13:19:22 +0000 Subject: [PATCH] - Cleaner platform distinguishing code. --- gui/Scyther/Scyther.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/gui/Scyther/Scyther.py b/gui/Scyther/Scyther.py index c58401f..f49c35c 100755 --- a/gui/Scyther/Scyther.py +++ b/gui/Scyther/Scyther.py @@ -41,16 +41,34 @@ class Scyther(object): global bindir # Where is my executable? + # + # Auto-detect platform and infer executable name from that + # 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 """ # TODO hardcoded for now, bad self.program = os.path.join(prefix,"Scyther.exe") if not os.path.isfile(self.program): print "I can't find the Scyther executable at %s" % (self.program) 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 self.spdl = None