Hey Stefan, > Hold on there, it seems that doesn't work either. Perhaps the > SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC constant isn't defined > when swig runs or something, I'll have a closer look now. I've attached a patch which should make the unlock prompt function agian on Linux, while not breaking on Windows. I also found a keyword in swig that removes the need for a separate declaration and implementation of the function, which I also used in this patch.
I've also attached a patch to prevent the testcase from running when gnome-keyring is not available, to prevent the test suite from failing on e.g. Windows. Gr. Matthijs
The conditional around the declaration of svn_auth_set_gnome_keyring_unlock_prompt_func (introduced in r1241585) was not functioning properly, it prevented the bindings from being generated on all platforms instead of just those without gnome-keyring support. This is because the swig preprocessor did not have the needed #defines available at the point where the function was declared. The reason the conditional does work for the implementation, is that the implementation is ignored by swig and included only in the core.c file, and that som other include (presumably) makes svn_auth.h available. To fix this, we move the declaration of the function to below the include of svn_auth.h. While we here, also merge the declaration and implementation using the swig %inline keyword. * core.i (svn_auth_set_gnome_keyring_unlock_prompt_func): Merge declaration with implementation and move both below the include of svn_auth.h. Patch by: Matthijs Kooijman <matth...@stdin.nl> Index: subversion-trunk/subversion/bindings/swig/core.i =================================================================== --- subversion-trunk.orig/subversion/bindings/swig/core.i 2012-02-07 22:45:23.544436835 +0100 +++ subversion-trunk/subversion/bindings/swig/core.i 2012-02-07 23:09:35.468418915 +0100 @@ -698,33 +698,6 @@ %authprompt_callback_typemap(ssl_server_trust) %authprompt_callback_typemap(ssl_client_cert) %authprompt_callback_typemap(ssl_client_cert_pw) - -%{ -#ifdef SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC -/* Helper function to set the gnome-keyring unlock prompt function. This - * C function accepts an auth baton, a function and a prompt baton, but - * the below callback_typemap uses both the function and the prompt - * baton, so the resulting binding has just two arguments: The auth - * baton and the prompt function. - * The prompt function should again have two arguments: The keyring name - * (string) and a pool (except for the ruby version, which doesn't have - * the pool argument). It should return the entered password (string). - * This binding generated for this function generates a reference to the - * prompt function that was passed into this. The caller should store - * that reference somewhere, to prevent the function from being garbage - * collected... - */ -static void svn_auth_set_gnome_keyring_unlock_prompt_func(svn_auth_baton_t *ab, - svn_auth_gnome_keyring_unlock_prompt_func_t prompt_func, - void *prompt_baton) { - svn_auth_set_parameter(ab, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC, - prompt_func); - svn_auth_set_parameter(ab, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON, - prompt_baton); -} -#endif -%} - %authprompt_callback_typemap(gnome_keyring_unlock) /* ----------------------------------------------------------------------- @@ -792,16 +765,6 @@ %include svn_pools_h.swg %include svn_version_h.swg -%{ -#ifdef SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC -/* This is the function defined above */ -void svn_auth_set_gnome_keyring_unlock_prompt_func(svn_auth_baton_t *ab, - svn_auth_gnome_keyring_unlock_prompt_func_t prompt_func, - void *prompt_baton); -#endif -%} - - /* The constant SVN_PROP_REVISION_ALL_PROPS is a C fragment, not a single data value, so the SWIG parser will raise a 305 warning if we don't suppress it. */ @@ -819,6 +782,34 @@ %include svn_mergeinfo_h.swg %include svn_io_h.swg + + +#ifdef SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC +%inline %{ +/* Helper function to set the gnome-keyring unlock prompt function. This + * C function accepts an auth baton, a function and a prompt baton, but + * the below callback_typemap uses both the function and the prompt + * baton, so the resulting binding has just two arguments: The auth + * baton and the prompt function. + * The prompt function should again have two arguments: The keyring name + * (string) and a pool (except for the ruby version, which doesn't have + * the pool argument). It should return the entered password (string). + * This binding generated for this function generates a reference to the + * prompt function that was passed into this. The caller should store + * that reference somewhere, to prevent the function from being garbage + * collected... + */ +static void svn_auth_set_gnome_keyring_unlock_prompt_func(svn_auth_baton_t *ab, + svn_auth_gnome_keyring_unlock_prompt_func_t prompt_func, + void *prompt_baton) { + svn_auth_set_parameter(ab, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC, + prompt_func); + svn_auth_set_parameter(ab, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON, + prompt_baton); +} +%} +#endif + #if defined(SWIGPERL) || defined(SWIGRUBY) %include svn_md5_h.swg #endif
Only run the gnome keyring unlock function test when the needed function is available. This should prevent test failures on platforms without gnome-keyring. * python/tests/client.py (testGnomeKeyring): Make conditional. Index: subversion-trunk/subversion/bindings/swig/python/tests/client.py =================================================================== --- subversion-trunk.orig/subversion/bindings/swig/python/tests/client.py 2012-02-07 22:54:04.455301070 +0100 +++ subversion-trunk/subversion/bindings/swig/python/tests/client.py 2012-02-07 22:55:09.703659797 +0100 @@ -380,6 +380,8 @@ self.assert_(isinstance(providers, list)) self.assert_(all(map(lambda x: isinstance(x, core.svn_auth_provider_object_t), providers))) + @unittest.skipUnless(hasattr(core, 'svn_auth_set_gnome_keyring_unlock_prompt_func'), + "not supported on this platform") def testGnomeKeyring(self): # This tests setting the gnome-keyring unlock prompt function as an # auth baton parameter. It doesn't actually call gnome-keyring
signature.asc
Description: Digital signature