Tony Lownds | f53dec2 | 2002-12-20 04:24:43 +0000 | [diff] [blame] | 1 | """IDLE.app |
| 2 | |
| 3 | Installation: |
| 4 | see the install_IDLE target in python/dist/src/Mac/OSX/Makefile |
| 5 | |
| 6 | Usage: |
| 7 | |
| 8 | 1. Double clicking IDLE icon will open IDLE. |
| 9 | 2. Dropping file on IDLE icon will open that file in IDLE. |
| 10 | 3. Launch from command line with files with this command-line: |
| 11 | |
| 12 | /Applications/Python/IDLE.app/Contents/MacOS/python file1 file2 file3 |
| 13 | |
| 14 | """ |
| 15 | |
| 16 | # Add IDLE.app/Contents/Resources/idlelib to path. |
| 17 | # __file__ refers to this file when it is used as a module, sys.argv[0] |
| 18 | # refers to this file when it is used as a script (pythonw macosx_main.py) |
| 19 | import sys |
| 20 | |
| 21 | from os.path import split, join, isdir |
| 22 | try: |
| 23 | __file__ |
| 24 | except NameError: |
| 25 | __file__ = sys.argv[0] |
| 26 | idlelib = join(split(__file__)[0], 'idlelib') |
| 27 | if isdir(idlelib): |
| 28 | sys.path.append(idlelib) |
| 29 | |
Tony Lownds | f53dec2 | 2002-12-20 04:24:43 +0000 | [diff] [blame] | 30 | # see if we are being asked to execute the subprocess code |
| 31 | if '-p' in sys.argv: |
| 32 | # run expects only the port number in sys.argv |
| 33 | sys.argv.remove('-p') |
| 34 | |
Tony Lownds | 103ee91 | 2002-12-23 18:11:28 +0000 | [diff] [blame] | 35 | # this module will become the namespace used by the interactive |
Tony Lownds | f53dec2 | 2002-12-20 04:24:43 +0000 | [diff] [blame] | 36 | # interpreter; remove all variables we have defined. |
Tony Lownds | 582fa88 | 2002-12-20 04:26:00 +0000 | [diff] [blame] | 37 | del sys, __file__, boolcheck, split, join, isdir |
Tony Lownds | f53dec2 | 2002-12-20 04:24:43 +0000 | [diff] [blame] | 38 | __import__('run').main() |
| 39 | else: |
| 40 | # Load idlelib/idle.py which starts the application. |
Tony Lownds | 103ee91 | 2002-12-23 18:11:28 +0000 | [diff] [blame] | 41 | import idle |