PDA

View Full Version : Application written in 10.5 with the Python bridge, will it work on 10.4?




Monkaaay
Nov 1, 2007, 05:14 PM
If I take advantage of xcode 3 and develop an application in Python/Cocoa, will it work on 10.4 or will it require 10.5?



Alloye
Nov 1, 2007, 06:52 PM
That depends on whether or not you use any Cocoa features that are specific to 10.5. In addition, Tiger users would need PyObjC and possibly an updated Python interpreter included with the app.

Monkaaay
Nov 1, 2007, 09:02 PM
Gotcha, so it's safer to say that Leopard is the target. Thanks for your help.

hhas
Nov 2, 2007, 01:32 PM
If I take advantage of xcode 3 and develop an application in Python/Cocoa, will it work on 10.4 or will it require 10.5?

If you want portability between Tiger and Leopard, you'll need to install your own Python framework and develop with that (there's a binary installer for 2.5.1 on www.python.org) and PyObjC (a 1.4 installer ( pyobjc.sourceforge.net) is available, or you can find 2.0 in the PyObjC repository (http://mail.python.org/pipermail/pythonmac-sig/2007-November/019356.html)).

To build a standalone application bundle containing a stripped-down interpreter and all dependencies, use py2app (http://www.undefined.org/python/). Note that this will add approx 4MB to your .dmg/.zip distribution - basically a non-issue for broadband users and usually tolerable for dialup users.

Obviously you'll need to avoid using Leopard-only OS features, at least when your application is running on Tiger. If you want to take advantage of Leopard features when available, you could always do a version check at launch and enable/disable the relevant sections of code as needed. You might also be able to find third-party Python and/or Cocoa libraries that provide equivalent features.

If you'd like to see a typical example of a standalone PyObjC app, take a look at the ASDictionary application on the appscript downloads page (http://appscript.sourceforge.net/download.html) (source is also available in svn). You might also want to subscribe to the PythonMac-SIG mailing list (http://mail.python.org/mailman/listinfo/pythonmac-sig) if you've not already done so.

HTH