mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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
4 changed files with 35 additions and 64 deletions
|
@ -42,6 +42,17 @@ IDLEfork-0.9xx.tar.gz
|
||||||
script to read:
|
script to read:
|
||||||
!# /usr/bin/python2.2
|
!# /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.
|
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)
|
self.rpcpid = os.spawnv(os.P_NOWAIT, args[0], args)
|
||||||
|
|
||||||
def build_subprocess_arglist(self):
|
def build_subprocess_arglist(self):
|
||||||
if sys.platform == 'darwin' and sys.argv[0].count('.app'):
|
w = ['-W' + s for s in sys.warnoptions]
|
||||||
# We need to avoid using sys.executable because it fails on some
|
# Maybe IDLE is installed and is being accessed via sys.path,
|
||||||
# of the applet architectures On Mac OS X.
|
# or maybe it's not installed and the idle.py script is being
|
||||||
#
|
# run from the IDLE source directory.
|
||||||
# here are the applet architectures tried:
|
if __name__ == 'idlelib.PyShell':
|
||||||
#
|
command = "__import__('idlelib.run').run.main()"
|
||||||
# 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)]
|
|
||||||
else:
|
else:
|
||||||
w = ['-W' + s for s in sys.warnoptions]
|
command = "__import__('run').main()"
|
||||||
# Maybe IDLE is installed and is being accessed via sys.path,
|
return [sys.executable] + w + ["-c", command, str(self.port)]
|
||||||
# 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)]
|
|
||||||
|
|
||||||
def start_subprocess(self):
|
def start_subprocess(self):
|
||||||
addr = ("localhost", self.port)
|
addr = ("localhost", self.port)
|
||||||
|
|
16
Lib/idlelib/buildapp.py
Normal file
16
Lib/idlelib/buildapp.py
Normal file
|
@ -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…
Add table
Add a link
Reference in a new issue