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

Re: [PATCH] Indentation error in swig binding

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Mon, 01 Nov 2010 12:09:54 +0000

prabhugnanasundar <prabhugs_at_collab.net> writes:

> I am using Debian Lenny. I get swig 1.3.25 with it by default. When I

According to

  http://packages.debian.org/search?keywords=swig

you should get 1.3.36. That's what I have on my Debian/lenny box.

> try to install the swig-py, I get indentation error at core.py file
> (line 3178). Since it is an auto generated code from core.i file,
> modifying the core.i file solved the problem.
> My friend uses swig 1.3.40 which comes with Fedora core 13. In that
> version everything works fine even if the indentation is changed at
> will. Though in swig 1.3.25 it works iff the indentation is proper.
> Hence the problem can be solved by indenting the core.i file.

With 1.3.36 the generated code looks like:

def svn_auth_open(*args):
  """
    svn_auth_open(svn_auth_baton_t auth_baton, apr_array_header_t providers,
        apr_pool_t pool)
    """
  val = apply(_core.svn_auth_open, args)
 
  val.__dict__["_deps"] = list(args[0])

  return val

With your patch it changes to:

def svn_auth_open(*args):
  """
    svn_auth_open(svn_auth_baton_t auth_baton, apr_array_header_t providers,
        apr_pool_t pool)
    """
  val = apply(_core.svn_auth_open, args)
 
    val.__dict__["_deps"] = list(args[0])

  return val

which doesn't work. Running "make check-swig-py" gives:

  File "/home/pm/sw/subversion/obj/subversion/bindings/swig/python/libsvn/core.py", line 2919
    val.__dict__["_deps"] = list(args[0])
    ^
IndentationError: unexpected indent
make: *** [check-swig-py] Error 1

> In r911480 rdonch has fixed an indentation error which he claims has
> solved the problem. But he did not mention the swig version. He has
> changed the indentation from two to three, but that does not work for

From three to two.

> swig 1.3.25. Hope my patch solves everyone's problem. I have the log and
> the patch as follows...
>
>
> [[[
> Clear the indentation problem in swig
> * subversion/bindings/swig/core.i
> (svn_auth_open): The default indentation of the file is found to be 2.
> subversion/bindings/swig/python/libsvn/core.py file
> generates indentation of 4.
>
> Patch by: Prabhu Gnana Sundar <prabhugs_at_collab.net>
> ]]]
>
>
> Index: subversion/bindings/swig/core.i
> ===================================================================
> --- subversion/bindings/swig/core.i (revision 1029575)
> +++ subversion/bindings/swig/core.i (working copy)
> @@ -751,7 +751,7 @@
> # references to the providers are gone, they will still be alive,
> # keeping the baton valid.
> %feature("pythonappend") svn_auth_open %{
> - val.__dict__["_deps"] = list(args[0])
> + val.__dict__["_deps"] = list(args[0])
> %}
> #endif

-- 
Philip
Received on 2010-11-01 13:10:36 CET

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.