On Mon, 2005-08-22 at 20:17 +0200, Filip Van Raemdonck wrote: > On Sun, Aug 21, 2005 at 11:26:27PM +0100, Gustavo J. A. M. Carneiro wrote: > > On Fri, 2005-08-19 at 20:33 +0200, Trond Andersen wrote: > > > I've read the developerworks article about GnomeVFS modules written in > > > C and looked into the python bindings (which looks very clean), but I > > > could not find information about how one would initialize a python > > > based GnomeVFS module. > > > > > > In the developerworks article the make file copies the configuration > > > file and the .so file to $prefix/lib/gnome-vfs-2.0/modules directory. > > > > > > Question is how this is handled with the python bindings. Is there a > > > need for a similar configuration file? Do I have to copy the python > > > file(s) to a specific directory? > > > > In response to your request, I have created a new VFS example in > > gnome-python: > > > > http://cvs.gnome.org/viewcvs/gnome-python/gnome-python/examples/vfs/pygvfsmethod/ > > What is the magic behind it? It's a bit non-obvious to me how gnome-vfs > figures out it it needs to look in that python file instead of trying to > load a shared library (and what method it needs to call).
You put "pyfs: pythonmethod" in a gnome-vfs configuration file (notice that the README asks you to install the file pyfs.conf). Therefore, when a pyfs:// URI is requested, gnome-vfs loads libpythonmethod.so, which receives the 'pyfs' method name and then tries to import the python module 'pyfs'. The standard python path search, plus $(libdir)/gnome-vfs-2.0/modules. In this module, it looks for a class called 'pyfs_method'. It then creates a new instance of this class, and tries to get the vfs_xxxx methods, which are then used to implement the VFS operations. Regards. -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> The universe is always one step beyond logic _______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
