Mercurial > cpython-lru_cache-weakref
diff Lib/idlelib/PyShell.py @ 25480:9d50bc831bca legacy-trunk
Finding a suitable interpreter to spawn needed tweaking on the Mac
| author | Tony Lownds <tony@lownds.com> |
|---|---|
| date | Sun, 29 Sep 2002 00:34:10 +0000 |
| parents | 6dec74f44242 |
| children | b39bd03a8dab |
line wrap: on
line diff
--- a/Lib/idlelib/PyShell.py Sun Sep 29 00:25:51 2002 +0000 +++ b/Lib/idlelib/PyShell.py Sun Sep 29 00:34:10 2002 +0000 @@ -160,12 +160,25 @@ 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()
