blob: 88e4197e857b2021774c784b1b7c49c66be7ec0b [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
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
33import boolcheck
34
35# see if we are being asked to execute the subprocess code
36if '-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.
42 del sys, __file__, boolcheck, split, join
43 __import__('run').main()
44else:
45 # Load idlelib/idle.py which starts the application.
46 import idle