[Pyobjc-dev] py2app alias builds broken on Snow Leopard
Brought to you by:
ronaldoussoren
From: James R E. <Jam...@lr...> - 2009-11-02 11:07:35
|
Hi folks, I haven't seen anything relating to this on the list, but it appears that the version of py2app that ships with Snow Leopard makes broken alias builds. The problems appears to be with the way it symlinks to the python interpreter. On 10.6, it links to /usr/bin/python, whereas in 10.5 it would symlink to the /System Python.framework version (see below). The result is that when __boot__.py builds the sys.path, it's sys.exec_prefix is /usr, so the proper site-packages (including PyObjC!) don't get included. See transcript below for more info. I've attached two patches (one for SVN trunk; one for the py2app that ships with Snow Leopard) that work for me. They modify the py2app build_alias_executable() method to symlink to sys.prefix/bin/python (if it exists) instead of sys.executable. This works for me, and I think it should normally be the correct behavior, but I'm not 100% convinced of that. Ronald: do you agree? See the transcript below for an illustration of the problem. Cheers! James ### Differences in built applications between 10.6 (above) and 10.5 (below) lri11-245:~/Projects/LRI/Scotty/Viewer/dist/Scotty.app/Contents/MacOS $ ll total 216 -rwxr-xr-x 1 eaganj eaganj 103292 Jul 1 08:26:26 2009 Scotty* lrwx------ 1 eaganj eaganj 15 Nov 2 10:34:05 2009 python@ -> / usr/bin/python lri11-245:~/Projects/LRI/ScottySVNSucks/Viewer/dist/Scotty.app/ Contents/MacOS $ ll total 176 -rwxr-xr-x 1 eaganj eaganj 83840 Sep 24 06:50:46 2007 Scotty* lrwx------ 1 eaganj eaganj 99 Jul 27 15:00:42 2009 python@ -> / System/Library/Frameworks/Python.framework/Versions/2.5/Resources/ Python.app/Contents/MacOS/Python ### Differences in running python via symlink: # First with python found on PATH lri11-245:~ $ which python /usr/bin/python lri11-245:~ $ python Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys; sys.executable '/usr/bin/python' >>> sys.prefix '/System/Library/Frameworks/Python.framework/Versions/2.6' # Now with Python via symlink lri11-245:~ $ ln -s /usr/bin/python symlink-python lri11-245:~ $ ./symlink-python Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys; sys.executable '/Users/eaganj/symlink-python' >>> sys.prefix '/usr' >>> # The prefixes are different depending on how the same python exec is invoked! # Note that /usr/bin/python is not a symlink lri11-245:~ $ ll /usr/bin/python* -rwxr-xr-x 2 root wheel 86000 Jul 8 08:57:10 2009 /usr/bin/python* -rwxr-xr-x 5 root wheel 925 Jul 8 08:57:08 2009 /usr/bin/python- config* lrwxr-xr-x 1 root wheel 75 Aug 29 14:00:38 2009 /usr/bin/ python2.5@ -> ../../System/Library/Frameworks/Python.framework/ Versions/2.5/bin/python2.5 lrwxr-xr-x 1 root wheel 82 Aug 29 14:00:38 2009 /usr/bin/ python2.5-config@ -> ../../System/Library/Frameworks/Python.framework/ Versions/2.5/bin/python2.5-config lrwxr-xr-x 1 root wheel 75 Aug 29 14:00:38 2009 /usr/bin/ python2.6@ -> ../../System/Library/Frameworks/Python.framework/ Versions/2.6/bin/python2.6 lrwxr-xr-x 1 root wheel 82 Aug 29 14:00:38 2009 /usr/bin/ python2.6-config@ -> ../../System/Library/Frameworks/Python.framework/ Versions/2.6/bin/python2.6-config -rwxr-xr-x 2 root wheel 86000 Jul 8 08:57:10 2009 /usr/bin/pythonw* lrwxr-xr-x 1 root wheel 76 Aug 29 14:00:38 2009 /usr/bin/ pythonw2.5@ -> ../../System/Library/Frameworks/Python.framework/ Versions/2.5/bin/pythonw2.5 lrwxr-xr-x 1 root wheel 76 Aug 29 14:00:38 2009 /usr/bin/ pythonw2.6@ -> ../../System/Library/Frameworks/Python.framework/ Versions/2.6/bin/pythonw2.6 # And that /usr/bin/python is apparently some kind of a wrapper program (sizes are different) lri11-245:~ $ ll /System/Library/Frameworks/Python.framework/Versions/ 2.6/bin/python2.6 -rwxr-xr-x 1 root wheel 50720 Jul 8 08:56:58 2009 /System/Library/ Frameworks/Python.framework/Versions/2.6/bin/python2.6* Patch for SVN trunk (made from py2app/trunk): |