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

Bob Ippolito bob at redivi.com
Tue Apr 27 01:16:47 EDT 2004


On Apr 27, 2004, at 12:50 AM, Ronald Oussoren wrote:

> On 27-apr-04, at 0:28, Bob Ippolito wrote:
>>
>>> 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.
>>
>> I wouldn't be terribly worried about this.. how many distutils are 
>> there? And how many of those distutils aren't just slight 
>> modifications to the current?
>
> I'm more worried about the amount of thought and testing that went 
> into the module this hotfix. I've only tested it by doing a quick 
> rebuild of PyObjC.
>
> The patch should be made safer by checking for 
> MACOSX_DEPLOYEMENT_TARGET and the current OS version (in the 
> __init__.py, not in the .pth file)

MACOSX_DEPLOYMENT_TARGET should be trusted if set to a reasonable 
value, and it should be injected into the environment if unset or 
otherwise not appropriate.  The OS version does NOT really matter!

Here is pseudocode for what should happen..

# this is important!  It makes very little sense to compile a 
10.2-compatible module against a 10.3+ python
injected_dt = max(dt_when_python_was_compiled, current_dt or 
dt_when_python_was_compiled)

# use it if we can
if injected_dt < '10.3':
	use '-framework Python'
else:
	use '-undefined dynamic_lookup'

We must preserve the MACOSX_DEPLOYMENT_TARGET that was set when python 
was compiled (requires a patch to python.. I am not an expert with the 
python build process so someone else will have to do this).  For a 
/System Python, it should be the current os version.

-bob




More information about the Pythonmac-SIG mailing list