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

Re: Swig Python binding

From: David James <james82_at_gmail.com>
Date: 2005-09-03 19:09:04 CEST

On 9/3/05, Rida Al Barazi <ralbarazi@gmail.com> wrote:
> Hi David,
>
> Thank you for your help, I thought that I installed SWIG correctly, but it
> was a mistake I had to compile it in the another directory with another
> prefix.
> In Plesk swig1.1 will be installed in /usr/bin/swig so I had to specify the
> prefix in ./configure before compiling it..
> Now I'm getting anothor error in libtool:
[snip]
> -I -DSVN_SWIG_VERSION=1001 -DSWIG_TABLE_TYPE=subversion -I/usr/local/src/subversion-1.2.3/apr/include
Oops! Looks like you're still using SWIG 1.1. You'll need to rerun
./configure to fix this (I see you did this below, and it solved the
problem).

> just in case you need the same information in the other post:
> which python => /usr/local/bin/python
> which python2 => /usr/bin/python2
> python -V => Python 2.4.1
> python2 -V => Python 2.2.2
Aha! Subversion 1.2.3 uses "python2" instead of "python", so it is
still compiling your extension for Python 2.2. (This is a bug -- it's
fixed in Subversion trunk, but the fix hasn't been released yet)

As a workaround, can you make "python2" point to /usr/local/bin/python
and rerun configure?

> python build/get-py-info.py --compile =>
> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
> -fPIC
Looks good!

> python2 build/get-py-info.py --compile =>
> USAGE: build/get-py-info.py WHAT
> Returns information about how to build Python extensions.
> WHAT may be one of:
> --includes : return -I include flags
> --compile : return a compile command
> --link : return a link command
> --libs : return just the library options for linking
Can you try this command again? This output doesn't look right at all.
  python2 build/get-py-info.py --compile

> I think I have to recompile swig with specifying python path
> [/usr/local/bin/python] also... let me try it.
This is a good idea.

> Tried to reconfigure/make/make install swig, and reconfigure subversion with
> swig and python path and then make swig-py getting these warnings inside:
> libtool: link: warning:
> `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../..//libgdbm.la' seems to be
> moved
> libtool: link: warning:
> `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../..//libdb-4.0.la' seems to
> be moved
> libtool: link: warning:
> `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../..//libexpat.la' seems to be
> moved
> libtool: link: warning:
> `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../..//libgdbm.la' seems to be
> moved
> libtool: link: warning:
> `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../..//libdb-4.0.la' seems to
> be moved
> libtool: link: warning:
> `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../..//libexpat.la' seems to be
> moved
> libtool: link: warning:
> `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../..//libgdbm.la' seems to be
> moved
> libtool: link: warning:
> `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../..//libdb-4.0.la' seems to
> be moved
> libtool: link: warning:
> `/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../..//libexpat.la' seems to be
> moved
These are harmless warnings. I get these warnings on my system too.

> when I try after that make install-swig-py... it's showing the same errors
> inside but with this at the end:
[snip]
> ./build/copy-swig-py.sh "/usr/bin/python2"
Oops! It's using the wrong version of Python, here. See my suggested
workaround above.
[snip]
> "/usr/local/src/subversion-1.2.3/ac-helpers/install-sh -c -m 644"
> "/usr/local/src/subversion-1.2.3/subversion/bindings/swig/python"
> "/usr/local/lib/svn-python/libsvn" ""; ./build/copy-swig-py.sh
> "/usr/bin/python2"
> "/usr/local/src/subversion-1.2.3/ac-helpers/install-sh -c -m 644"
> "/usr/local/src/subversion-1.2.3/subversion/bindings/swig/python/svn"
> "/usr/local/lib/svn-python/svn" ""; if test /usr/local/src/subversion-1.2.3
> != /usr/local/src/subversion-1.2.3; then ./build/copy-swig-py.sh
> "/usr/bin/python2"
> "/usr/local/src/subversion-1.2.3/ac-helpers/install-sh -c -m 644"
> "/usr/local/src/subversion-1.2.3/subversion/bindings/swig/python"
> "/usr/local/lib/svn-python/libsvn" ""; fi
> Listing /usr/local/lib/svn-python/libsvn ...
> Compiling /usr/local/lib/svn-python/libsvn/__init__.py ...
> Compiling /usr/local/lib/svn-python/libsvn/client.py ...
> Compiling /usr/local/lib/svn-python/libsvn/core.py ...
> Compiling /usr/local/lib/svn-python/libsvn/delta.py ...
> Compiling /usr/local/lib/svn-python/libsvn/fs.py ...
> Compiling /usr/local/lib/svn-python/libsvn/ra.py ...
> Compiling /usr/local/lib/svn-python/libsvn/repos.py ...
> Compiling /usr/local/lib/svn-python/libsvn/wc.py ...
> Listing /usr/local/lib/svn-python/svn ...
> Compiling /usr/local/lib/svn-python/svn/__init__.py ...
> Compiling /usr/local/lib/svn-python/svn/client.py ...
> Compiling /usr/local/lib/svn-python/svn/core.py ...
> Compiling /usr/local/lib/svn-python/svn/delta.py ...
> Compiling /usr/local/lib/svn-python/svn/fs.py ...
> Compiling /usr/local/lib/svn-python/svn/ra.py ...
> Compiling /usr/local/lib/svn-python/svn/repos.py ...
> Compiling /usr/local/lib/svn-python/svn/wc.py ...
Other than the "python2" problem, it looks like it's working, so far.

> Restarted my server tried "trac" again.. getting the same error:
> Traceback (most recent call last):
> File "/usr/local/bin/trac-admin", line 34, in ?
> from trac import sync
> File "/usr/local/lib/python2.4/site-packages/trac/sync.py", line 22, in ?
> from svn import core, fs, delta, repos
> ImportError: No module named svn
>
> Any Thoughts?
Python can't find the svn.core library. Try running python like this:
   PYTHONPATH=/usr/local/lib/svn-python python

Once python is started, type "import svn.core", and tell me whether it works.

Hope this helps!

David

-- 
David James -- http://www.cs.toronto.edu/~james
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Sep 3 19:10:43 2005

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