blob: 8fdeeb1b6a8cf7afc226fc0e5dd32c7c20de4de0 [file] [log] [blame]
Tony Lownds1fc1fe82002-12-23 18:36:14 +00001#!/usr/bin/env pythonw
Tony Lowndsf53dec22002-12-20 04:24:43 +00002"""IDLE.app
3
4Installation:
5 see the install_IDLE target in python/dist/src/Mac/OSX/Makefile
Kurt B. Kaiser6655e4b2002-12-31 16:03:23 +00006
7Usage:
Tony Lowndsf53dec22002-12-20 04:24:43 +00008
91. Double clicking IDLE icon will open IDLE.
102. Dropping file on IDLE icon will open that file in IDLE.
113. Launch from command line with files with this command-line:
12
13 /Applications/Python/IDLE.app/Contents/MacOS/python file1 file2 file3
14
15"""
16
17# Add IDLE.app/Contents/Resources/idlelib to path.
18# __file__ refers to this file when it is used as a module, sys.argv[0]
19# refers to this file when it is used as a script (pythonw macosx_main.py)
20import sys
21
22from os.path import split, join, isdir
23try:
24 __file__
25except NameError:
26 __file__ = sys.argv[0]
27idlelib = join(split(__file__)[0], 'idlelib')
28if isdir(idlelib):
Kurt B. Kaiser6655e4b2002-12-31 16:03:23 +000029 sys.path.append(idlelib)
Tony Lowndsf53dec22002-12-20 04:24:43 +000030
Tony Lowndsf53dec22002-12-20 04:24:43 +000031# see if we are being asked to execute the subprocess code
32if '-p' in sys.argv:
33 # run expects only the port number in sys.argv
34 sys.argv.remove('-p')
35
Tony Lownds103ee912002-12-23 18:11:28 +000036 # this module will become the namespace used by the interactive
Tony Lowndsf53dec22002-12-20 04:24:43 +000037 # interpreter; remove all variables we have defined.
Tony Lowndsd8a6c5f2002-12-31 16:52:44 +000038 del sys, __file__, split, join, isdir, idlelib
Tony Lowndsf53dec22002-12-20 04:24:43 +000039 __import__('run').main()
40else:
41 # Load idlelib/idle.py which starts the application.
Tony Lownds103ee912002-12-23 18:11:28 +000042 import idle