1. The command-line arguments for subprocesses no longer need to be
specialized for Mac OS X. 2. buildapp.py - a new file for building an application icon for IDLE on Mac OS X. See INSTALL.txt
This commit is contained in:
parent
e9a54a3eaf
commit
2398d578a3
|
@ -41,6 +41,17 @@ IDLEfork-0.9xx.tar.gz
|
|||
at python1.5. If so, change the first line in the /usr/bin/idle
|
||||
script to read:
|
||||
!# /usr/bin/python2.2
|
||||
|
||||
On Mac OS X, /usr/bin/python may be pointing at the OS-installed
|
||||
python, which does not have GUI support. Change the first line of
|
||||
/usr/bin/idle to read:
|
||||
#! /usr/bin/env pythonw
|
||||
|
||||
Also, to build an IDLE application that can be used from the Finder
|
||||
on Mac OS X, run:
|
||||
pythonw buildapp.py build
|
||||
open build
|
||||
You will see an IDLE application.
|
||||
|
||||
See README.txt for more details on this version of IDLEfork.
|
||||
|
||||
|
|
|
@ -311,29 +311,15 @@ class ModifiedInterpreter(InteractiveInterpreter):
|
|||
self.rpcpid = os.spawnv(os.P_NOWAIT, args[0], args)
|
||||
|
||||
def build_subprocess_arglist(self):
|
||||
if sys.platform == 'darwin' and sys.argv[0].count('.app'):
|
||||
# We need to avoid using sys.executable because it fails on some
|
||||
# of the applet architectures On Mac OS X.
|
||||
#
|
||||
# here are the applet architectures tried:
|
||||
#
|
||||
# framework applet: sys.executable + -p is correct
|
||||
# python 2.2 + pure python main applet:
|
||||
# sys.executable + -p is correct
|
||||
# pythonw idle.py: sys.executable + -c is correct
|
||||
#
|
||||
# XXX what about warnoptions?
|
||||
return [sys.executable, '-p', str(self.port)]
|
||||
w = ['-W' + s for s in sys.warnoptions]
|
||||
# Maybe IDLE is installed and is being accessed via sys.path,
|
||||
# or maybe it's not installed and the idle.py script is being
|
||||
# run from the IDLE source directory.
|
||||
if __name__ == 'idlelib.PyShell':
|
||||
command = "__import__('idlelib.run').run.main()"
|
||||
else:
|
||||
w = ['-W' + s for s in sys.warnoptions]
|
||||
# Maybe IDLE is installed and is being accessed via sys.path,
|
||||
# or maybe it's not installed and the idle.py script is being
|
||||
# run from the IDLE source directory.
|
||||
if __name__ == 'idlelib.PyShell':
|
||||
command = "__import__('idlelib.run').run.main()"
|
||||
else:
|
||||
command = "__import__('run').main()"
|
||||
return [sys.executable] + w + ["-c", command, str(self.port)]
|
||||
command = "__import__('run').main()"
|
||||
return [sys.executable] + w + ["-c", command, str(self.port)]
|
||||
|
||||
def start_subprocess(self):
|
||||
addr = ("localhost", self.port)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# After running python setup.py install, run this program from the command
|
||||
# line like so:
|
||||
#
|
||||
# % python2.3 buildapp.py build
|
||||
#
|
||||
# A double-clickable IDLE application will be created in the build/ directory.
|
||||
#
|
||||
|
||||
from bundlebuilder import buildapp
|
||||
|
||||
buildapp(
|
||||
name="IDLE",
|
||||
mainprogram="idle.py",
|
||||
argv_emulation=1,
|
||||
)
|
|
@ -1,42 +0,0 @@
|
|||
#!/usr/bin/env pythonw
|
||||
# IDLE.app
|
||||
#
|
||||
# Installation:
|
||||
# see the install_IDLE target in python/dist/src/Mac/OSX/Makefile
|
||||
#
|
||||
# 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):
|
||||
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')
|
||||
|
||||
# this module will become the namespace used by the interactive
|
||||
# interpreter; remove all variables we have defined.
|
||||
del sys, __file__, split, join, isdir, idlelib
|
||||
__import__('run').main()
|
||||
else:
|
||||
# Load idlelib/idle.py which starts the application.
|
||||
import idle
|
Loading…
Reference in New Issue