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

Re: [PATCH] Fix swig-py bindings with SWIG 3.0.4

From: Branko ─îibej <brane_at_wandisco.com>
Date: Wed, 11 Feb 2015 14:36:31 +0100

On 11.02.2015 13:58, Andreas Stieger wrote:
> Hello,
>
>> I saw build errors in the bindings with SWIG 3.0.4:
>> ./subversion/bindings/swig/core.i:792: Error: Unknown SWIG preprocessor
>> directive: The (if this is a block of target language code, delimit it
>> with %{ and %})
> And here is the missing part for proxy.swg for review...
>
> [[[
> Follow-up to 1655262,1658347: Fix for python bindings build with Swig 3.0.x
>
> * subversion/bindings/swig/include/proxy.swg:
> Escape comments
>
> Patch by: Dominique Leuenberger <dimstar_at_opensuse.org>
> Found by: me
> ]]]
>
> Andreas

Unfortunately, this does not fix the Python bindings. Yes, with this
patch, 'make swig-py' works, but 'make check-swig-py' fails, because the
comments are not expanded correctly in the generated Python file.

This is from the generated subversion/bindings/swig/python/libsvn/core.py:

    def __getattr__(self, name):
      """Get an attribute from this object"""
      self.assert_valid()

      value = _swig_getattr(self, self.__class__, name)

    #If we got back a different object than we have, we need to copy all our
    etadata into it, so that it looks identical%}
      members = self.__dict__.get("_members")
      if members is not None:
        _copy_metadata_deep(value, members.get(name))

And so on. Note how the multi-line comments are mangled, and how the
closing '%}' is still there. According to the docs, the whole
%pythoncode block should be enclosed in '%{' '%}' rather than the
current '{' '}'; doing that lets 'make swig-py' work, but the comments
are still mangled.

This is clearly a bug in Swig; I can't imagine it being anything else.
The only workaround I could find was to remove the comments entirely.
Even then, the generated Python bindings don't work because of the use
of the argument-less svn_pool_create() in the wrong context, but I think
this is a different bug.

For now, I can only recommend that we do not support Swig 3.0.

-- Brane
Received on 2015-02-11 14:40:29 CET

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