blob: 9a965eda4f776af69cccbac391d132092471e70d [file] [log] [blame]
Tony Lowndsf53dec22002-12-20 04:24:43 +00001"""IDLE.app
2
3Installation:
4 see the install_IDLE target in python/dist/src/Mac/OSX/Makefile
5
6Usage:
7
81. Double clicking IDLE icon will open IDLE.
92. Dropping file on IDLE icon will open that file in IDLE.
103. 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)
19import sys
20
21from os.path import split, join, isdir
22try:
23 __file__
24except NameError:
25 __file__ = sys.argv[0]
26idlelib = join(split(__file__)[0], 'idlelib')
27if isdir(idlelib):
28 sys.path.append(idlelib)
29
Tony Lowndsf53dec22002-12-20 04:24:43 +000030# see if we are being asked to execute the subprocess code
31if '-p' in sys.argv:
32 # run expects only the port number in sys.argv
33 sys.argv.remove('-p')
34
Tony Lownds103ee912002-12-23 18:11:28 +000035 # this module will become the namespace used by the interactive
Tony Lowndsf53dec22002-12-20 04:24:43 +000036 # interpreter; remove all variables we have defined.
Tony Lownds582fa882002-12-20 04:26:00 +000037 del sys, __file__, boolcheck, split, join, isdir
Tony Lowndsf53dec22002-12-20 04:24:43 +000038 __import__('run').main()
39else:
40 # Load idlelib/idle.py which starts the application.
Tony Lownds103ee912002-12-23 18:11:28 +000041 import idle