[tahoe-lafs-trac-stream] [Tahoe-LAFS] #1432: Magic Folder on Mac OS X and other BSDs
Tahoe-LAFS
trac at tahoe-lafs.org
Wed Apr 13 12:03:40 UTC 2016
#1432: Magic Folder on Mac OS X and other BSDs
-------------------------------------+-------------------------------------
Reporter: davidsarah | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: undecided
Component: code-frontend- | Version: 1.8.2
magic-folder | Keywords: fsevents mac bsd magic-
Resolution: | folder
Launchpad Bug: |
-------------------------------------+-------------------------------------
Comment (by dawuud):
Of the several steps needed to setup the Apple async filesystem events API
we need to firstly call ''FSEventStreamCreate''.
There's a snippet of code showing the ''FSEventStreamCreate'' being used:
https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/UsingtheFSEventsFramework.html
It doesn't look like ctypes allows the creation of c structs or objective
c objects unless you redefine them and create them the ctypes way. So
initially I was thinking that maybe recreating all the necessary
structs/objective-c-objects in python ctypes manually is kinda tricky...
and requires us to have the Apple source code or at least the .h header
files with the struct/object definitions.
Perhaps the pyobjc library can help us to compose these objective-c
structures so that we can use
ctypes to pass them into API functions. Here need a python equivalent for
composing the CFArray of CFString which holds the filesystems paths to
watch:
{{{
CFStringRef mypath = CFSTR("/path/to/scan");
CFArrayRef pathsToWatch = CFArrayCreate(NULL, (const void **)&mypath,
1, NULL);
void *callbackInfo = NULL; // could put stream-specific data here.
FSEventStreamRef stream;
CFAbsoluteTime latency = 3.0; /* Latency in seconds */
}}}
The pyobjc module requies xcode and when I pip installed it after properly
installed xcode it downloaded many more modules; I wonder if this thing is
too heavy weight. We probably want to avoid heavyweight dependencies?
I also discovered that google wrote a ctypes wrapper for Apple objective-c
structures in this project:
https://github.com/google/grr
https://github.com/google/grr/blob/master/grr/client/osx/objc.py
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1432#comment:18>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list