Skip to content

Commit 2398d57

Browse files
committed
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
1 parent e9a54a3 commit 2398d57

4 files changed

Lines changed: 35 additions & 64 deletions

File tree

‎Lib/idlelib/INSTALL.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ IDLEfork-0.9xx.tar.gz
4141
at python1.5. If so, change the first line in the /usr/bin/idle
4242
script to read:
4343
!# /usr/bin/python2.2
44+
45+
On Mac OS X, /usr/bin/python may be pointing at the OS-installed
46+
python, which does not have GUI support. Change the first line of
47+
/usr/bin/idle to read:
48+
#! /usr/bin/env pythonw
49+
50+
Also, to build an IDLE application that can be used from the Finder
51+
on Mac OS X, run:
52+
pythonw buildapp.py build
53+
open build
54+
You will see an IDLE application.
4455

4556
See README.txt for more details on this version of IDLEfork.
4657

‎Lib/idlelib/PyShell.py‎

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -311,29 +311,15 @@ def spawn_subprocess(self):
311311
self.rpcpid = os.spawnv(os.P_NOWAIT, args[0], args)
312312

313313
def build_subprocess_arglist(self):
314-
if sys.platform == 'darwin' and sys.argv[0].count('.app'):
315-
# We need to avoid using sys.executable because it fails on some
316-
# of the applet architectures On Mac OS X.
317-
#
318-
# here are the applet architectures tried:
319-
#
320-
# framework applet: sys.executable + -p is correct
321-
# python 2.2 + pure python main applet:
322-
# sys.executable + -p is correct
323-
# pythonw idle.py: sys.executable + -c is correct
324-
#
325-
# XXX what about warnoptions?
326-
return [sys.executable, '-p', str(self.port)]
314+
w = ['-W' + s for s in sys.warnoptions]
315+
# Maybe IDLE is installed and is being accessed via sys.path,
316+
# or maybe it's not installed and the idle.py script is being
317+
# run from the IDLE source directory.
318+
if __name__ == 'idlelib.PyShell':
319+
command = "__import__('idlelib.run').run.main()"
327320
else:
328-
w = ['-W' + s for s in sys.warnoptions]
329-
# Maybe IDLE is installed and is being accessed via sys.path,
330-
# or maybe it's not installed and the idle.py script is being
331-
# run from the IDLE source directory.
332-
if __name__ == 'idlelib.PyShell':
333-
command = "__import__('idlelib.run').run.main()"
334-
else:
335-
command = "__import__('run').main()"
336-
return [sys.executable] + w + ["-c", command, str(self.port)]
321+
command = "__import__('run').main()"
322+
return [sys.executable] + w + ["-c", command, str(self.port)]
337323

338324
def start_subprocess(self):
339325
addr = ("localhost", self.port)

‎Lib/idlelib/buildapp.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# After running python setup.py install, run this program from the command
3+
# line like so:
4+
#
5+
# % python2.3 buildapp.py build
6+
#
7+
# A double-clickable IDLE application will be created in the build/ directory.
8+
#
9+
10+
from bundlebuilder import buildapp
11+
12+
buildapp(
13+
name="IDLE",
14+
mainprogram="idle.py",
15+
argv_emulation=1,
16+
)

‎Lib/idlelib/macosx_main.py‎

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)