Search code examples
pythonsvnwindows-server-2008visualsvn-server

Python SVN Bindings on Windows Server 2008 x64


My goal is to use the python scripts in subversion\tools, specifically validate-extensions.py in this case. I am running VisualSVN Server 2.15, built on Subversion 1.6.15 and have 32-bit Python 2.7.1 set up on the machine at the moment.

When I set up the hook, I got an error that the svn module could not be found. I installed the latest libsvn bindings I could find (http://trac.edgewall.org/attachment/wiki/TracSubversion/svn-win32-1.6.15_py_2.7.zip from http://trac.edgewall.org/wiki/TracSubversion) but I still can't load the svn module. If I run 'from svn import repos' from the command line, I get:

File "C:\Python27\lib\site-packages\libsvn\core.py", line 21, in swig_import_helper _mod = imp.load_module('_core', fp, pathname, description) ImportError: DLL load failed: The specified procedure could not be found.

Am I missing something? I also tried the Python27 64-bit release but precompiled svn bindings don't appear to be available for it and I would prefer not to go through everything required to build them myself.

Thank you in advance for your help.


Solution

  • I found an answer to this on the Subversion mailing list. The problem is that the Python 2.7 SVN bindings provided by Trac were built using an older version of an Apache dll, namely libapr-1.dll, and they reference a function called '_apr_time_ansi_put@8'. In the later versions of Apache, including VisualSVN 2.1.5, the libapr-1.dll is newer and the function has been renamed to '_apr_time_ansi_put@12'.

    To fix this, I downloaded the old Apache bindings from http://subversion.tigris.org/files/documents/15/47914/svn-win32-1.6.6.zip, renamed the VisualSVN\bin\libapr-1.dll to libapr-1.dll.bak, copied the older libapr-1.dll to the VisualSVN\bin folder and restarted the service. No more issues, python 'from svn import core' works fine and the validate-extensions.py hook is running correctly.