[Pythonmac-SIG] building extensions that link against dynamic libraries - Fixed!

Jack Jansen Jack.Jansen at cwi.nl
Mon Apr 26 17:58:13 EDT 2004


On 26 Apr 2004, at 22:14, Ronald Oussoren wrote:
>> You can simply change the linker flags that distutils uses by sudo  
>> editing the LDSHARED (definitely) and BLDSHARED (maybe) definitions  
>> in:
>> /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
>> python2.3/config/Makefile
>
> If you're really sick you can get the same effect by some sneaky  
> Python code.

We need *something* like this to implement Bob's idea of using  
dynamic_lookup to fix the two-python problem, and while this solution  
is better than what I have now (which is absolutely nothing) I'm not  
100% satisfied with it.

The main problem I have is that the .pth trick means that this code  
will be run in every single Python invocation. In other words, every  
run of Python  will start off by fiddling with the distutils internals  
(with all the side effects and imports and such that this concurs).  
Does anyone have any smart ideas on how we could  fix this, so we only  
execute this code when distutils is actually used?

For 2.4 we can fix this once and for all by having distutils try and do  
an "import distutils_hotfix" in __init__, but that doesn't help us for  
apple-installed 2.3.

I also have slight misgivings about the way the script will fix any  
distutils that comes on its path (I would prefer to fix only things  
we're 100% sure we can fix), but that's easy to change.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  
Goldman




More information about the Pythonmac-SIG mailing list