diff --git a/Lib/idlelib/INSTALL.txt b/Lib/idlelib/INSTALL.txt index ed7ac69b9e9..2488d28eef4 100644 --- a/Lib/idlelib/INSTALL.txt +++ b/Lib/idlelib/INSTALL.txt @@ -41,6 +41,17 @@ IDLEfork-0.9xx.tar.gz at python1.5. If so, change the first line in the /usr/bin/idle script to read: !# /usr/bin/python2.2 + + On Mac OS X, /usr/bin/python may be pointing at the OS-installed + python, which does not have GUI support. Change the first line of + /usr/bin/idle to read: + #! /usr/bin/env pythonw + + Also, to build an IDLE application that can be used from the Finder + on Mac OS X, run: + pythonw buildapp.py build + open build + You will see an IDLE application. See README.txt for more details on this version of IDLEfork. diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index af3267a9162..6e3a43a40a4 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -311,29 +311,15 @@ class ModifiedInterpreter(InteractiveInterpreter): self.rpcpid = os.spawnv(os.P_NOWAIT, args[0], args) def build_subprocess_arglist(self): - if sys.platform == 'darwin' and sys.argv[0].count('.app'): - # We need to avoid using sys.executable because it fails on some - # of the applet architectures On Mac OS X. - # - # here are the applet architectures tried: - # - # framework applet: sys.executable + -p is correct - # python 2.2 + pure python main applet: - # sys.executable + -p is correct - # pythonw idle.py: sys.executable + -c is correct - # - # XXX what about warnoptions? - return [sys.executable, '-p', str(self.port)] + w = ['-W' + s for s in sys.warnoptions] + # Maybe IDLE is installed and is being accessed via sys.path, + # or maybe it's not installed and the idle.py script is being + # run from the IDLE source directory. + if __name__ == 'idlelib.PyShell': + command = "__import__('idlelib.run').run.main()" else: - w = ['-W' + s for s in sys.warnoptions] - # Maybe IDLE is installed and is being accessed via sys.path, - # or maybe it's not installed and the idle.py script is being - # run from the IDLE source directory. - if __name__ == 'idlelib.PyShell': - command = "__import__('idlelib.run').run.main()" - else: - command = "__import__('run').main()" - return [sys.executable] + w + ["-c", command, str(self.port)] + command = "__import__('run').main()" + return [sys.executable] + w + ["-c", command, str(self.port)] def start_subprocess(self): addr = ("localhost", self.port) diff --git a/Lib/idlelib/buildapp.py b/Lib/idlelib/buildapp.py new file mode 100644 index 00000000000..42aeeb7e50f --- /dev/null +++ b/Lib/idlelib/buildapp.py @@ -0,0 +1,16 @@ +# +# After running python setup.py install, run this program from the command +# line like so: +# +# % python2.3 buildapp.py build +# +# A double-clickable IDLE application will be created in the build/ directory. +# + +from bundlebuilder import buildapp + +buildapp( + name="IDLE", + mainprogram="idle.py", + argv_emulation=1, +) diff --git a/Lib/idlelib/macosx_main.py b/Lib/idlelib/macosx_main.py deleted file mode 100644 index bc91a0b35ab..00000000000 --- a/Lib/idlelib/macosx_main.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env pythonw -# IDLE.app -# -# Installation: -# see the install_IDLE target in python/dist/src/Mac/OSX/Makefile -# -# Usage: -# -# 1. Double clicking IDLE icon will open IDLE. -# 2. Dropping file on IDLE icon will open that file in IDLE. -# 3. Launch from command line with files with this command-line: -# -# /Applications/Python/IDLE.app/Contents/MacOS/python file1 file2 file3 -# -# - -# Add IDLE.app/Contents/Resources/idlelib to path. -# __file__ refers to this file when it is used as a module, sys.argv[0] -# refers to this file when it is used as a script (pythonw macosx_main.py) -import sys - -from os.path import split, join, isdir -try: - __file__ -except NameError: - __file__ = sys.argv[0] -idlelib = join(split(__file__)[0], 'idlelib') -if isdir(idlelib): - sys.path.append(idlelib) - -# see if we are being asked to execute the subprocess code -if '-p' in sys.argv: - # run expects only the port number in sys.argv - sys.argv.remove('-p') - - # this module will become the namespace used by the interactive - # interpreter; remove all variables we have defined. - del sys, __file__, split, join, isdir, idlelib - __import__('run').main() -else: - # Load idlelib/idle.py which starts the application. - import idle