Reputation: 10024
I'm new in the Python world, coming from PHP. So, this question may sound silly for experienced Python developers, but I'm really confused.
So, I want to implement simple Python app to work with subversion. For that purpose I want to use python bindings for subversion, so I installed Ubuntu python-subversion and python-subversion-dbg packages.
$ ll /usr/lib/pyshared/python2.6/libsvn
total 6460
drwxr-xr-x 2 root root 4096 2011-12-03 17:01 ./
drwxr-xr-x 23 root root 4096 2011-12-03 09:47 ../
-rw-r--r-- 1 root root 790331 2011-08-05 19:59 _client_d.so
-rw-r--r-- 1 root root 320844 2011-08-05 20:00 _client.so
-rw-r--r-- 1 root root 900465 2011-08-05 19:59 _core_d.so
-rw-r--r-- 1 root root 379804 2011-08-05 20:00 _core.so
-rw-r--r-- 1 root root 300336 2011-08-05 19:59 _delta_d.so
-rw-r--r-- 1 root root 115932 2011-08-05 20:00 _delta.so
-rw-r--r-- 1 root root 228879 2011-08-05 19:59 _diff_d.so
-rw-r--r-- 1 root root 89532 2011-08-05 20:00 _diff.so
-rw-r--r-- 1 root root 345484 2011-08-05 19:59 _fs_d.so
-rw-r--r-- 1 root root 137400 2011-08-05 20:00 _fs.so
-rw-r--r-- 1 root root 582390 2011-08-05 19:59 _ra_d.so
-rw-r--r-- 1 root root 231864 2011-08-05 20:00 _ra.so
-rw-r--r-- 1 root root 491500 2011-08-05 19:59 _repos_d.so
-rw-r--r-- 1 root root 196668 2011-08-05 20:00 _repos.so
-rw-r--r-- 1 root root 1038898 2011-08-05 19:59 _wc_d.so
-rw-r--r-- 1 root root 426008 2011-08-05 20:00 _wc.so
I tried to add /usr/lib/pyshared/python2.6/libsvn as library in Eclipse from PyDev > Interpreter Python > Libraries > New Folder. But I still can't import anything from svn package. I also see that there are no .py files, just .so.
I just want to be able to use it like on http://svnbook.red-bean.com/en/1.1/ch08s02.html
My code:
from svn import fs
Erro I get:
File "/home/umpirsky/EclipseWorkspace/test/src/test.py", line 1, in <module> ImportError: cannot import name fs
How can I import this?
Upvotes: 1
Views: 788
Reputation: 5789
I remember installing this a while ago. Did you follow all the step of the? The ones that you have to get right are:
If that runs you know you are ok with the build. Then install pysvn by copying the following from Extension/Source to python site-specific directory.
mkdir python-libdir/site-packages/pysvn
cp pysvn/__init__.py python-libdir/site-packages/pysvn
cp pysvn/_pysvn*.so python-libdir/site-packages/pysvn
By default you site-packages should be under: /usr/local/lib/pythonX.Y/site-packages
Once you've copied that, on Eclipse:
Window->Preferences->Pydev->Interpreter Python
Under System PYTHONPATH add the folder you created above.
I've found that sometimes Pydev won't pick the new source folder for whatever reason. So, I just remove the compiler and add it again. When you do that Pydev will pick everything up under site-packages.
Edit: Here are the download instructions of what you need. I thought you had downloaded the same package as python-svn. I actually haven't use the distribution you downloaded. But I think pysvn will do the trick for you and it has good documentation if you are just starting.
The install guide should get you going with the install. If you get lost with it refer to the notes that I have above.
site-package is just the standard location for python installed modules.
Upvotes: 1