comparison svnwrap/svn_swig_wrapper.py @ 272:25d843281127

Use svn 1.6 platform specific auth providers if available
author Patrick Mezard <pmezard@gmail.com>
date Wed, 22 Apr 2009 23:24:58 +0200
parents a5f20358f737
children ce676eff002b
comparison
equal deleted inserted replaced
271:5278817fe8a1 272:25d843281127
60 def _create_auth_baton(pool): 60 def _create_auth_baton(pool):
61 """Create a Subversion authentication baton. """ 61 """Create a Subversion authentication baton. """
62 # Give the client context baton a suite of authentication 62 # Give the client context baton a suite of authentication
63 # providers.h 63 # providers.h
64 platform_specific = ['svn_auth_get_gnome_keyring_simple_provider', 64 platform_specific = ['svn_auth_get_gnome_keyring_simple_provider',
65 'svn_auth_get_gnome_keyring_ssl_client_cert_pw_provider', 65 'svn_auth_get_gnome_keyring_ssl_client_cert_pw_provider',
66 'svn_auth_get_keychain_simple_provider', 66 'svn_auth_get_keychain_simple_provider',
67 'svn_auth_get_keychain_ssl_client_cert_pw_provider', 67 'svn_auth_get_keychain_ssl_client_cert_pw_provider',
68 'svn_auth_get_kwallet_simple_provider', 68 'svn_auth_get_kwallet_simple_provider',
69 'svn_auth_get_kwallet_ssl_client_cert_pw_provider', 69 'svn_auth_get_kwallet_ssl_client_cert_pw_provider',
70 'svn_auth_get_ssl_client_cert_file_provider', 70 'svn_auth_get_ssl_client_cert_file_provider',
71 'svn_auth_get_windows_simple_provider', 71 'svn_auth_get_windows_simple_provider',
72 'svn_auth_get_windows_ssl_server_trust_provider', 72 'svn_auth_get_windows_ssl_server_trust_provider',
73 ] 73 ]
74 74
75 providers = [] 75 providers = []
76 76 # Platform-dependant authentication methods
77 for p in platform_specific: 77 getprovider = getattr(core, 'svn_auth_get_platform_specific_provider',
78 if hasattr(core, p): 78 None)
79 try: 79 if getprovider:
80 providers.append(getattr(core, p)()) 80 # Available in svn >= 1.6
81 except RuntimeError: 81 for name in ('gnome_keyring', 'keychain', 'kwallet', 'windows'):
82 pass 82 for type in ('simple', 'ssl_client_cert_pw', 'ssl_server_trust'):
83 p = getprovider(name, type, pool)
84 if p:
85 providers.append(p)
86 else:
87 for p in platform_specific:
88 if hasattr(core, p):
89 try:
90 providers.append(getattr(core, p)())
91 except RuntimeError:
92 pass
83 93
84 providers += [ 94 providers += [
85 client.get_simple_provider(), 95 client.get_simple_provider(),
86 client.get_username_provider(), 96 client.get_username_provider(),
87 client.get_ssl_client_cert_file_provider(), 97 client.get_ssl_client_cert_file_provider(),