[Distutils] virtual-python.py, sys.prefix, and Mac

Ian Bicking ianb at colorstudy.com
Wed Sep 19 19:23:23 CEST 2007


Ronald Oussoren wrote:
>  
> On Wednesday, September 19, 2007, at 07:26AM, "Ian Bicking" <ianb at colorstudy.com> wrote:
> 
>>> It is in the python.org source tree: Modules/getpath.c
>> That's the file used in the Framework build of Python?  I only see some 
>> small references to __APPLE__, none of which seem related to Frameworks. 
>>  Also, if you build Python from source it works fine -- it's only the 
>> python that Apple ships that has the problem.  They must use some 
>> patched version of this file that they use...?
> 
> Start reading at line 694 in Modules/getpath.c, that's in the head of the release25-maint branch.

It's only 695 lines long...?

At line 458 it seems like it is looking for lib/python2.5/os.py, in some 
Framework-specific code.  It will look relative to the binary, but only 
after looking in the Framework first.  Simply breaking the Framework 
lookup somehow would do it.

Here's the code to find the Framework locations:

     pythonModule = 
NSModuleForSymbol(NSLookupAndBindSymbol("_Py_Initialize"));
     /* Use dylib functions to find out where the framework was loaded 
from */
     buf = (char *)NSLibraryNameForModule(pythonModule);

I'm not sure how to do anything to that though.

-- 
Ian Bicking : ianb at colorstudy.com : http://blog.ianbicking.org
             : Write code, do good : http://topp.openplans.org/careers


More information about the Distutils-SIG mailing list