> Is there an objective-c wrapper for the functions you want to get at?
Not that I could find in the apple provided frameworks
At least a search for "ACL" only turns up the examples related to
identity services (generic ACL not FS ACL), AFP, or the listed C
examples
It would be relatively straightforward to write an ObjC wrapper - but
that seems a bit much to do that just for a python bridge wrapper...
-Preston
This is always a balancing act, particularly given the obscure nature
of some of the APIs. In cases like what you're describing I've
resorted to using ctypes since that lets me avoid compiling C objects
but still allows me to pretty directly translate C code and extend it.
In the case of the Keychain APIs a local spotlight search works for
the basic info but I had to resort to http://google.com/codesearch in
several places to find working code since the documentation provided
little of value.
The downside to the ctypes approach is that you won't see anything
which only exists as a C define - you can either duplicate those in
Python (e.g. http://code.google.com/p/pymacadmin/source/browse/lib/PyMacAdmin/Security/__init__.py)
or simply write a little throwaway C program which printfs the value
you need if it's something which isn't generally useful.
Chris
> The downside to the ctypes approach is that you won't see anything
> which only exists as a C define
This was the case for acl.h
I don't think it is available in any compiled framework library
But I'm not really sure how I would verify that for certain
-P
I'm wondering how to supply a char* argument to something from
PyObjC. [ My full question is at http://stackoverflow.com/questions/1268667/call-a-selector-that-takes-a-char-from-pyobjc
; with that and getting a "Tumbleweed" badge on my last PyObjC
question ( http://stackoverflow.com/questions/1229830/error-drawing-text-on-nsimage-in-pyobjc
), I'm starting to think that Stack Overflow isn't a great place for
PyObjC questions.]
Basically, I'm trying to call a function that has a selector defined as:
- (BOOL) hasRecordsOfType:(const char*) inType
and PyObjC doesn't know to change the string I supply it into a char
*. Using ctypes sounded interesting. I just tried:
node
.hasRecordsOfType_(ctypes.c_char_p('dsRecTypeStandard:ComputerLists'))
but get
ValueError: depythonifying 'char', got 'c_char_p'
Clinton
node.hasRecordsOfType_(ctypes.c_char_p('dsRecTypeStandard:ComputerLists'))but getValueError: depythonifying 'char', got 'c_char_p'
what about using nsstrings cStringUsingEncoding: ?
It is supposed to take a string and return char *
-P
It is also possible to generate bridge support metadata for a standaloneC library (here, libcurl):gen_bridge_metadata -c '-lcurl -I/usr/include/curl'/usr/include/curl/*.h > /Library/BridgeSupport/curl.bridgesupport