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 | |
| 30 | # Make sure True, False, bool() builtins exist. |
| 31 | # - preserves 2.2 compatibility - 2.2.1 includes bool, 2.2 does not. |
| 32 | # - important for Mac OS X because it ships python 2.2 |
| 33 | import boolcheck |
| 34 | |
| 35 | # see if we are being asked to execute the subprocess code |
| 36 | if '-p' in sys.argv: |
| 37 | # run expects only the port number in sys.argv |
| 38 | sys.argv.remove('-p') |
| 39 | |
| 40 | # this module will become the namepsace used by the interactive |
| 41 | # interpreter; remove all variables we have defined. |
Tony Lownds | 582fa88 | 2002-12-20 04:26:00 +0000 | [diff] [blame] | 42 | del sys, __file__, boolcheck, split, join, isdir |
Tony Lownds | f53dec2 | 2002-12-20 04:24:43 +0000 | [diff] [blame] | 43 | __import__('run').main() |
| 44 | else: |
| 45 | # Load idlelib/idle.py which starts the application. |
| 46 | import idle |