[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

how to write a notify_func in python?

From: Scott Collins <scc_at_ScottCollins.net>
Date: 2003-06-06 21:12:51 CEST

I'm trying to write a Python script that watches an |snv_client_update|
and mirrors the result up to a remote website on which I can't directly
have a repository, and to which my only access is ftp.

To do this, I think I want to write a |svn_wc_notify_func_t|. At the
urging of sussman, I'm trying to use the python bindings. I couldn't
find anything in svn/tools/examples that looked like a good model for
this. In fact, no callbacks written in Python were apparent to me in
these sources at all. After reading all about SWIG, I see that it
doesn't _directly_ support implementing callback functions in the
scripting language, however, it's still possible through `thunks'
involving special script-environment-aware calls. I see the code that
does this for the callback I want to implement. It's
|svn_swig_py_notify_func| and its implementation starts in the
neighborhood of line 901 in svn/subversion/bindings/swig/swigutil_py.c.

It's not obvious how I'm supposed to use this from Python. The name
doesn't show up in any of the Python svn modules directly. It does
appear, however, in svn_wc.i (an input file that helps generate the
swig bindings) where I see:

   /*
-----------------------------------------------------------------------
      handle svn_wc_notify_func_t/baton pairs
   */

   %typemap(python,in) (svn_wc_notify_func_t notify_func, void
*notify_baton) {

     $1 = svn_swig_py_notify_func;
     $2 = $input; /* our function is the baton. */
   }

I can't tell from this how to build a function in Python that can be
used as such a callback, nor can I find any examples. Help?
__________
Scott Collins <http://ScottCollins.net/>

  • application/pgp-signature attachment: PGP.sig
Received on Fri Jun 6 21:13:50 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.