cpython/Lib/idlelib/macosx_main.py

43 lines
1.2 KiB
Python
Raw Normal View History

2002-12-23 14:36:14 -04:00
#!/usr/bin/env pythonw
"""IDLE.app
Installation:
see the install_IDLE target in python/dist/src/Mac/OSX/Makefile
2002-12-31 12:03:23 -04:00
Usage:
1. Double clicking IDLE icon will open IDLE.
2. Dropping file on IDLE icon will open that file in IDLE.
3. Launch from command line with files with this command-line:
/Applications/Python/IDLE.app/Contents/MacOS/python file1 file2 file3
"""
# Add IDLE.app/Contents/Resources/idlelib to path.
# __file__ refers to this file when it is used as a module, sys.argv[0]
# refers to this file when it is used as a script (pythonw macosx_main.py)
import sys
from os.path import split, join, isdir
try:
__file__
except NameError:
__file__ = sys.argv[0]
idlelib = join(split(__file__)[0], 'idlelib')
if isdir(idlelib):
2002-12-31 12:03:23 -04:00
sys.path.append(idlelib)
# see if we are being asked to execute the subprocess code
if '-p' in sys.argv:
# run expects only the port number in sys.argv
sys.argv.remove('-p')
2002-12-23 14:11:28 -04:00
# this module will become the namespace used by the interactive
# interpreter; remove all variables we have defined.
2002-12-24 13:22:53 -04:00
del sys, __file__, split, join, isdir
__import__('run').main()
else:
# Load idlelib/idle.py which starts the application.
2002-12-23 14:11:28 -04:00
import idle