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

Re: [PATCH] Wrap svn_delta_path_driver_cb_func_t for Python

From: Eric Gillespie <epg_at_pretzelnet.org>
Date: 2007-04-12 23:07:31 CEST

This seems low impact to me, i'm going to go ahead and commit
it. We can always revert if i screw something up ;->

Eric Gillespie <epg@pretzelnet.org> writes:

> [[[
> Fix Python binding for svn_delta_path_driver_cb_func_t (and therefore
> svn.delta.path_driver).
>
> * subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
> (svn_swig_py_delta_path_driver_cb_func): New wrapper function.
>
> * subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
> (svn_swig_py_delta_path_driver_cb_func): Declare.
>
> * subversion/bindings/swig/svn_delta.i
> (svn_delta_path_driver_cb_func_t): Provide Python typemap, too.
> ]]]
>
> Index: subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
> ===================================================================
> --- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (revision 24558)
> +++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (working copy)
> @@ -1873,6 +1873,42 @@
> }
>
>
> +svn_error_t *svn_swig_py_delta_path_driver_cb_func(void **dir_baton,
> + void *parent_baton,
> + void *callback_baton,
> + const char *path,
> + apr_pool_t *pool)
> +{
> + PyObject *function = callback_baton;
> + PyObject *result;
> + svn_error_t *err = SVN_NO_ERROR;
> +
> + if (function == NULL || function == Py_None)
> + return err;
> +
> + svn_swig_py_acquire_py_lock();
> + result = PyObject_CallFunction(function, (char *)"OsO&",
> + svn_swig_NewPointerObjString(parent_baton,
> + "void *",
> + application_py_pool),
> + path, make_ob_pool, pool);
> + if (result == NULL)
> + {
> + err = callback_exception_error();
> + }
> + else if (result != Py_None)
> + {
> + if (svn_swig_ConvertPtr(result, dir_baton, svn_swig_TypeQuery("void *")) == -1)
> + {
> + err = type_conversion_error("void *");
> + }
> + }
> +
> + svn_swig_py_release_py_lock();
> + return err;
> +}
> +
> +
> svn_error_t *svn_swig_py_cancel_func(void *cancel_baton)
> {
> PyObject *function = cancel_baton;
> Index: subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h
> ===================================================================
> --- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h (revision 24558)
> +++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.h (working copy)
> @@ -254,6 +254,15 @@
> const char *path,
> svn_wc_status_t *status);
>
> +/* a svn_delta_path_driver callback that executes a Python function
> + that is passed in via the baton argument */
> +SVN_SWIG_SWIGUTIL_EXPORT
> +svn_error_t *svn_swig_py_delta_path_driver_cb_func(void **dir_baton,
> + void *parent_baton,
> + void *callback_baton,
> + const char *path,
> + apr_pool_t *pool);
> +
> /* a cancel function that executes a Python function passed in via the
> cancel_baton argument. */
> SVN_SWIG_SWIGUTIL_EXPORT
> Index: subversion/bindings/swig/svn_delta.i
> ===================================================================
> --- subversion/bindings/swig/svn_delta.i (revision 24558)
> +++ subversion/bindings/swig/svn_delta.i (working copy)
> @@ -145,11 +145,11 @@
> handle svn_delta_path_driver().
> */
>
> -#ifdef SWIGRUBY
> +#ifndef SWIGPERL
> %callback_typemap(svn_delta_path_driver_cb_func_t callback_func,
> void *callback_baton,
> + svn_swig_py_delta_path_driver_cb_func,
> ,
> - ,
> svn_swig_rb_delta_path_driver_cb_func)
> #endif
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>

-- 
Eric Gillespie <*> epg@pretzelnet.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 12 23:08:42 2007

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.