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

Re: Merging the ctypes python bindings to trunk

From: David James <james82_at_gmail.com>
Date: Tue, 30 Sep 2008 14:07:30 -0700

On Tue, Sep 30, 2008 at 1:58 PM, Eric Gillespie <epg_at_pretzelnet.org> wrote:
> "David James" <james82_at_gmail.com> writes:
>
>> 1. I taught ctypesgen to wrap all APIs, even if the API is not
>> present in the libraries on your platform.
>> 2. I updated the Subversion headers to include platform-specific
>> functions if 'CTYPESGEN' is defined.
>
> Can you show what this
>
> try:
> providers.append(svn.core.svn_auth_get_windows_ssl_server_trust_provider())
> except AttributeError:
> pass
>
> looks like with csvn now? It looks like you're saying that even
> these platform-specific interfaces are always bound; so how does
> an application know whether to use it or not? Does it raise
> NotImplementedError or something?

Hi Eric,

ctypesgen always attempts to bind the platform-specific interfaces at
runtime, but it only succeeds if the function actually exists on your
platform.

See the code from functions.py below:

# /home/david/dj/svn/svn-apr13/include/subversion-1/svn_auth.h: 893
for _lib in _libs.values():
    if hasattr(_lib, 'svn_auth_get_windows_ssl_server_trust_provider'):
        svn_auth_get_windows_ssl_server_trust_provider =
_lib.svn_auth_get_windows_ssl_server_trust_provider
        svn_auth_get_windows_ssl_server_trust_provider.restype = None
        svn_auth_get_windows_ssl_server_trust_provider.argtypes =
[POINTER(POINTER(svn_auth_provider_object_t)), POINTER(apr_pool_t)]
        break

On Linux, the svn_auth_get_windows_ssl_server_trust_provider doesn't
exist in any library, so it isn't bound. But if you copy this header
file to a Windows machine, then the function will be bound. Here's an
example of attempting to use this function on Linux:

$ python -c 'import csvn.core;
csvn.core.svn_auth_get_windows_ssl_server_trust_provider()'
Traceback (most recent call last):
  File "<string>", line 1, in ?
AttributeError: 'module' object has no attribute
'svn_auth_get_windows_ssl_server_trust_provider'

(Note also that ctypes uses the 'csvn.core' namespace, not "svn.core".)

Hope this helps,

David

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-30 23:07:42 CEST

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.