blob: d5aab04bc4c6a39ce953e1f879b1007732a9eb3c [file] [log] [blame]
Steven M. Gavad7b6ed22001-06-25 07:23:57 +00001#! /usr/bin/env python
2
Tony Lowndsf53dec22002-12-20 04:24:43 +00003# Add IDLE.app/Contents/Resources/idlelib to path.
4# __file__ refers to this file when it is used as a module, sys.argv[0]
5# refers to this file when it is used as a script (pythonw macosx_main.py)
6import sys
7from os.path import split, join
8try:
9 __file__
10except NameError:
11 __file__ = sys.argv[0]
12idlelib = join(split(__file__)[0], 'idlelib')
13if os.path.isdir(idlelib):
14 sys.path.append(idlelib)
15
16# Make sure True, False, bool() builtins exist.
17# - preserves 2.2 compatibility - 2.2.1 includes bool, 2.2 does not.
18# - important for Mac OS X because it ships python 2.2
19import boolcheck
20
21# see if we are being asked to execute the subprocess code
22if '-p' in sys.argv:
23 # run expects only the port number in sys.argv
24 sys.argv.remove('-p')
25
26 # this module will become the namepsace used by the interactive
27 # interpreter; remove all variables we have defined.
28 del sys, __file__, boolcheck, split, join
29 __import__('run').main()
30else:
31 # start the application.
32 import PyShell
33 PyShell.main()