This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Framework install does not behave as a framework
Type: behavior Stage: resolved
Components: macOS Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: mdehoon, ronaldoussoren
Priority: high Keywords:

Created on 2010-06-01 14:13 by mdehoon, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg106838 - (view) Author: Michiel de Hoon (mdehoon) * Date: 2010-06-01 14:12
(The discussion for this bug started on the pythonmac-sig mailing list; see http://mail.python.org/pipermail/pythonmac-sig/2010-May/022362.html)

When I try to install Python as a framework:

./configure --enable-framework
make
make install

then Python gets installed under /Library/Frameworks/Python.framework/Versions/2.7, but it doesn't seem to function as a framework:

>>> import MacOS
>>> MacOS.WMAvailable()
False
>>> 

Python 2.6.5 returns True here. This is important for GUI extension modules; such modules do not interact correctly with the window manager if Python is not installed as a framework.

I see the same behavior with the current Python in trunk with Mac OS X 10.4 and 10.5 both with Python installed from source and the precompiled python 2.7b2. Python revision 77030 seems to be the last revision without this problem. In revision 77031, posix_spawn() was introduced instead of execv() in pythonw.c to start the Python executable.
msg106839 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-01 14:17
The pythonw executable always uses execv on OSX 10.4 because posix_spawnv isn't available there.

A possibly significant change is the value of argv[0] as passed to the Python.app executable.

Could you check if this patch fixes the issue?


Index: Mac/Tools/pythonw.c
===================================================================
--- Mac/Tools/pythonw.c	(revision 81605)
+++ Mac/Tools/pythonw.c	(working copy)
@@ -149,6 +149,8 @@
 main(int argc, char **argv) {
     char* exec_path = get_python_path();
 
+    argv[0] = exec_path;
+
 #ifdef HAVE_SPAWN_H
 
     /* We're weak-linking to posix-spawnv to ensure that
msg106840 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-01 14:23
Note that the subject is not entirely correct: the framework install is a framework install, but the python commandline doesn't behave like an application bundle.
msg106843 - (view) Author: Michiel de Hoon (mdehoon) * Date: 2010-06-01 15:18
The patch fixes the problem on Mac OS X 10.4. I'll try on 10.5 tomorrow.
Thanks!
msg106872 - (view) Author: Michiel de Hoon (mdehoon) * Date: 2010-06-02 02:01
The patch solves the problem also on Mac OS X 10.5 (I tried 32-bits and 64-bits with the current python in trunk, after applying the patch).
Thanks again!
msg106876 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-06-02 03:51
Thanks for testing.

I've applied the patch (with some additional documentation) in r81649 (2.7) and r81650 (3.2).  Other versions are not affected.
History
Date User Action Args
2022-04-11 14:57:01adminsetgithub: 53114
2010-06-02 03:51:33ronaldoussorensetstatus: open -> closed
versions: + Python 3.2
messages: + msg106876

resolution: fixed
stage: needs patch -> resolved
2010-06-02 02:01:18mdehoonsetmessages: + msg106872
2010-06-01 15:18:17mdehoonsetmessages: + msg106843
2010-06-01 14:23:21ronaldoussorensetpriority: normal -> high

messages: + msg106840
stage: needs patch
2010-06-01 14:17:26ronaldoussorensetmessages: + msg106839
2010-06-01 14:13:00mdehooncreate