Re: [Pyobjc-dev] Find By Content
Brought to you by:
ronaldoussoren
From: Pierce T. W. I. <pi...@tw...> - 2003-11-14 21:33:05
|
On Friday, November 14, 2003, at 02:17 PM, Bob Ippolito wrote: > > On Nov 14, 2003, at 3:43 PM, Dethe Elza wrote: > >> I am trying to get started using PyObjC. What I'm interested in is >> creating a command-line search tool using the Find By Content API, >> which is in the ApplicationServices framework. But I haven't been >> able to figure out how to bootstrap far enough to find the API calls >> from Python. >> >> Is the ApplicationServices framework already exposed by PyObjC? >> >> If not, how do I wrap it? I've tried to follow the instructions >> here: http://pyobjc.sourceforge.net/doc/wrapping.php, but haven't had >> luck with it. > > ApplicationServices is not an Objective C framework, it can not be > wrapped (directly) with PyObjC. > > As you can see by the documentation ( > http://developer.apple.com/documentation/Carbon/Reference/ > Find_By_Content/index.html ), it's part of Carbon. Carbon frameworks > are a lot more work to wrap. You'll want to use a tool like bgen, > Pyrex, or SWIG .. or just write the bindings by hand (see "Extending > and Embedding" and "Python/C API" at > http://www.python.org/doc/current/ ). It's not very fun. There's > also the option of writing an ObjC framework that wraps the C > functions, but that doesn't look like it would make much sense in this > case as the functions are not primarily CoreFoundation based. In > short, it's not possible to wrap any APi that was available in Mac OS > before OS X (and even several new APIs that are not ObjC) using PyObjC > (directly). > > Currently, the only part of the Find by Content API that is wrapped > are the error codes ;) You're on your own here, properly wrapping > about 50 functions and having them work correctly takes a good while > even if you know the tools well. You may want to ask on pythonmac-sig > if anyone wants to volunteer to write it, or to help write it. Actually, the easiest way to wrap a C framework for Python is to write an Obj-C wrapper for it, IMHO. That's what I've been doing. Often you can find someone else who's done the work for you... Pierce |