summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorTony Lownds <tony@lownds.com>2002-09-29 00:34:10 (GMT)
committerTony Lownds <tony@lownds.com>2002-09-29 00:34:10 (GMT)
commitf2324b9e8964a7aef964ae6168827ad300f920d6 (patch)
tree76e8c5f9ce1a222c7d4cfd34ecd8e552289982e6 /Lib
parentbffa52f07fc73b3c8eb4b30e30e2417bc406d2ee (diff)
downloadcpython-f2324b9e8964a7aef964ae6168827ad300f920d6.zip
cpython-f2324b9e8964a7aef964ae6168827ad300f920d6.tar.gz
cpython-f2324b9e8964a7aef964ae6168827ad300f920d6.tar.bz2
Finding a suitable interpreter to spawn needed tweaking on the Mac
Diffstat (limited to 'Lib')
-rw-r--r--Lib/idlelib/PyShell.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py
index 3a819a8..195942f 100644
--- a/Lib/idlelib/PyShell.py
+++ b/Lib/idlelib/PyShell.py
@@ -160,12 +160,25 @@ class ModifiedInterpreter(InteractiveInterpreter):
rpcclt = None
rpcpid = None
- def spawn_subprocess(self):
- w = ['-W' + s for s in sys.warnoptions]
- args = [sys.executable] + w + ["-c", "__import__('run').main()",
- str(self.port)]
+ def spawn_subprocess(self):
+ w = ['-W' + s for s in sys.warnoptions]
+ args = [self.find_executable()] + w \
+ + ["-c", "__import__('run').main()", str(self.port)]
self.rpcpid = os.spawnv(os.P_NOWAIT, args[0], args)
+ def find_executable(self):
+ if sys.platform == 'darwin' and sys.executable.count('.app'):
+ # On Mac OS X, avoid calling sys.executable because it ignores
+ # command-line options (sys.executable is an applet)
+ #
+ # Instead, find the executable by looking relative to
+ # sys.prefix.
+ executable = os.path.join(sys.prefix, 'Resources',
+ 'Python.app', 'Contents', 'MacOS', 'python')
+ return executable
+ else:
+ return sys.executable
+
def start_subprocess(self):
addr = ("localhost", self.port)
self.spawn_subprocess()