[Pythonmac-SIG] ANN: Preview of SystemConfiguration wrapper
bob at redivi.com
Sun Oct 19 09:25:51 EDT 2003
On Sunday, Oct 19, 2003, at 08:57 America/New_York, Ronald Oussoren
> On 19 okt 2003, at 9:51, Bob Ippolito wrote:
>> This is a source distribution, it requires PyObjC and Developer
>> Tools. The wrapper itself is (entirely) an ObjC framework, but it
>> includes everything necessary for Python wrapping. I haven't done
>> any documentation, real tests, especially testing of the runloop
>> integration.. but here it is if someone wants to play with it. The
>> ObjC is a little sloppy (three classes in one file), and the setup.py
>> is a lot sloppy (thanks to distutils being not easily extensible),
>> but it works.. or at least it should.
> I haven't looked at your code yet, but wouldn't it be better to
> generate the wrapper using bgen? That would make the wrapper easier
> to maintain and easier to integrate into MacPython/the python core.
> The CodeGenerator scripts in PyObjC could also be coaxed into
> generating a functioning wrapper That is, without significant changes
> to the scripts. The prototypes are different enough to require changes
> to the "parser".
I decided against bgen for a couple reasons:
- bgen is hard to use
- I'm not yet convinced that the code generators save that much time
in the long run
- I wrote it by mostly by hand so I know that each and every method
has been "audited" by someone to at least look like it should work ;)
- Using a bgen-generated Python module doesn't feel much better than
coding in C. These are named so that the module feels like they're
- SystemConfiguration is one of those
should've-already-been-wrapped-in-ObjC-by-Apple frameworks that uses a
lot of CoreFoundation types, so the bridge code is already in PyObjC
for the most part (lots of CFDictionaryRef, CFArray, CFString, etc.)
- It might be useful from ObjC someday. Surely by someone in the ObjC
community that isn't using any or a lot of Python yet.
- The SystemConfiguration framework has awkward rules about when you
need to check for errors, so I'd have to write a lot of helpers by hand
anyway. Since bgen helpers are in C, not ObjC, it would be much more
of a pain in the ass to write them (i.e. more like 20 lines of code per
hand-wrapped function instead of an average of maybe 4 here).
More information about the Pythonmac-SIG