[Pythonmac-SIG] Link against Python Framework

Ronald Oussoren ronaldoussoren at mac.com
Wed Sep 9 15:45:39 CEST 2009


 
On Wednesday, 09 September, 2009, at 02:10PM, "Georg Seifert" <georg.seifert at gmx.de> wrote:
>Hi,
>
>In my Cocoa app, I link agains the Python framework to be able to call  
>"PyRun_SimpleString" and load bundles based on python.
>
>If I set the Base SDK to 10.5, it runs on 10.5 and 10.6. But if I set  
>it to 10.6 and MACOSX_DEPLOYMENT_TARGET = 10.5 it complains in Leopard  
>that it can’t find python 2.6.
>
>Is there a my to always use the current python version (2.5 on Leopard  
>and 2.6 on Snow Leopard)
>
>I link against the "/System/Library/Frameworks/Python.framework"

In short: no, that is not possible.

Major Python releases (such as 2.5 and 2.6) are not necessarily binary compatibel. If you are careful you can get a single binary that works with 2.5 and 2.6, but you then have to load the framework manually and also manually resolve any python API functions you are using.  The easiest way to do that is using the CFBundle APIs in CoreFoundation.

It might be easier to create two plugin bundles for your application: one that links against 2.6 and one that links against 2.5. You can then load the plugin that is most appropriate for the currently running OS version. 

Ronald

>
>Regards
>Georg
>
>_______________________________________________
>Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>http://mail.python.org/mailman/listinfo/pythonmac-sig
>
>


More information about the Pythonmac-SIG mailing list