Message 81525 - Python tracker (original) (raw)
IDLE is supposed to have various menu customizations when running on OS X. But currently they do not all work and the menus vary if IDLE is launched via IDLE.app versus via command line bin/idle. The most noticeable issue is the lack of a Preferences menu item in IDLE.app to access the IDLE configuration settings.
ANALYSIS There are inconsistent OS X execution checks scattered throughout idlelib. Also, the bootstrap mechanism for IDLE.app causes sys.executable to be set incorrectly. Most importantly, idlemain imports idlelib before it has fixed up the execution environment. This can cause the menu fixup in idlelib.Bindings to be skipped.
SOLUTION Change idlemain to set up the execution environment consistently and defer idlelib imports until it has done so. Modify several OS X checks in idlelib for consistency.
APPLIES py3k, 3.0 -> patch-nad0014-py3k-30.txt trunk, 2.6 -> patch-nad0014-trunk-26.txt
DELETE Mac/IDLE/idlemain.py (py3k and 3.0 only!)
NOTE In 3.x idlemain.py was copied down into the app bundle: 2.x -> Mac/IDLE/idlemain.py 3.x -> Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py 3.x -> Mac/IDLE/idlemain.py -> unused / delete so there are two versions of this patch. However, the 2.x location was not deleted in 3.x svn so there are two identical files in 3.x prior to this patch.