Subversion Cover Library for Python

Subversion documentation provides an example of using Subversion from Python

#!/usr/bin/python import svn.fs, svn.core, svn.repos def crawl_filesystem_dir(root, directory): """Recursively crawl DIRECTORY under ROOT in the filesystem, and return a list of all the paths at or below DIRECTORY.""" # Get the directory entries for DIRECTORY. entries = svn.fs.svn_fs_dir_entries(root, directory) 

When I run this code, I get an import error:

 $ python crawl.py Traceback (most recent call last): File "crawl.py", line 7, in <module> import svn.fs, svn.core, svn.repos ImportError: No module named svn.fs 

This means that I am missing the svn library. I tried installing the package, but Python Package Manager could not find it.

 $ pip install svn Downloading/unpacking svn Could not find any downloads that satisfy the requirement svn No distributions at all found for svn 

So how do I install this library?

+6
source share
2 answers

The library referenced by this documentation is SWIG-based wrappers that are built and shipped with Subversion. So - if your package is a subversion operating system package, find the subversion-python package to send along with it. If you are creating subversion from source, you need to use the --with-python configure option for the bindings that will be created side by side.

An alternative (with a completely different API) is the third-party pysvn shell . They are better documented and easier to use, but also less efficient in terms of runtime performance (they do not realize all the reuse capabilities of connections and such undocumented โ€œofficialโ€ bindings).

+9
source

You need to install subversion-python in order to be able to import classes.

In my case (Fedora)

 sudo yum install subversion-python 

Apt-get should have more or less the same

+2
source

Source: https://habr.com/ru/post/915663/


All Articles