ViewCVS and Apache on Windows Setup Quick Reference

  1. Get the SVN Python bindings from subversion.tigris.org
  2. Install the ActivePython version that corresponds to those SVN python bindings (find it on ftp.activestate.com) (it normally installs in c:\PythonNN where NN is the version number - leave this directory name that way to avoid future problems)
  3. Copy the two directories "svn" and "libsvn" from the SVN Python bindings into C:\PythonNN\Lib\site-packages
  4. Check that the Python shell can load the SVN bindings:
    • Launch C:\PythonNN\Python.exe
    • enter "import svn.repos": it should not give any error message (- CTRL-Z and Enter to exit Python shell)
  5. Get ViewCVS (see this comment below) and unpack it to a directory.
  6. From the ViewCVS directory, perform C:\PythonNN\Python.exe viewcvs-install (or simply add the extension .py to the viewcvs-install file and double-click on it)
  7. Edit the viewcvs.conf file to have no cvs_root and have the following lines
    svn_roots = RepositoryDirName: c:/path/to/parent/RepositoryDirName
    root_parents = c:/path/to/parent : svn
    default_root = RepositoryDirName
    

    (this sets up path/to/parent as being the root of all SVN
    repositories, with RepositoryDirName as the default repository to open)

  8. Make sure that %PATH% contains the \bin directory of your SVN installation
  9. Test: try to run standalone.py (or standalone.py -g if you want a GUI interface): it should allow you to browse your repository (no need to go further if this does not work!)

ViewCVS with Apache setup

  1. Add the following line to your httpd.conf file
    LoadModule python_module modules/mod_python.so
    
  2. Add also the following script alias and corresponding handler:
    ScriptAlias /viewcvs "C:/path/to/viewcvs/install/www/mod_python/viewcvs.py"
    <location /viewcvs>
       AddHandler python-program .py
       PythonPath "[r'c:\\path\\to\\viewcvs\\install\\lib']+sys.path"
       PythonHandler apache
       PythonDebug On
       AddDefaultCharset UTF-8
    </location>
    
  3. Test: launch apache and try to access localhost/viewcvs!
Mon, 2005-07-18 12:58
( categories: )

2 Errors with python2.5.1

I get the following error when I run the standalone.py file

An Exception Has Occurred
Python Traceback

Traceback (most recent call last):
  File "C:\Program Files\viewvc-1.0.4\lib\viewvc.py", line 3665, in main
    request.run_viewvc()
  File "C:\Program Files\viewvc-1.0.4\lib\viewvc.py", line 253, in run_viewvc
    import vclib.svn
  File "C:\Program Files\viewvc-1.0.4\lib\vclib\svn\__init__.py", line 25, in 
    from svn import fs, repos, core, delta
  File "c:\Python25\lib\site-packages\svn\fs.py", line 19, in 
    from libsvn.fs import *
  File "c:\Python25\lib\site-packages\libsvn\fs.py", line 5, in 
    import _fs
ImportError: No module named _fs

-----------------------------------------------------------------
I get this error when try to import "svn.repos" while inside the python cli.

Traceback (most recent call last):
  File "", line 1, in 
  File "c:\Python25\lib\site-packages\svn\repos.py", line 19, in 
    from libsvn.repos import *
  File "c:\Python25\lib\site-packages\libsvn\repos.py", line 5, in 
    import _repos
ImportError: No module named _repos
>>>

Any help?

Python path

The Subversion libraries are not on your Python path.

Install Viewvc with Apache have a error

When open in browser have a error like below:

Mod_python error: "PythonHandler apache"

Traceback (most recent call last):
  File "F:\Python23\Lib\site-packages\mod_python\apache.py", line 287, in HandlerDispatch log=debug)
  File "F:\Python23\Lib\site-packages\mod_python\apache.py", line 461, in import_module f, p, d = imp.find_module(parts[i], path)

ImportError: No module named apache

I have the same error message...

Mod_python error: "PythonHandler apache"

Traceback (most recent call last):

  File "C:\PYTHON23\Lib\site-packages\mod_python\apache.py", line 287, in HandlerDispatch
    log=debug)

  File "C:\PYTHON23\Lib\site-packages\mod_python\apache.py", line 461, in import_module
    f, p, d = imp.find_module(parts[i], path)

ImportError: No module named apache

I had to resort to the viewvc.cgi method to get everything work together.

Apache services:
Apache/2.0.58 (Win32) DAV/2 SVN/1.3.2 PHP/5.1.4 mod_python/3.2.8 
Python/2.3.5 Server at localhost Port 80

I'm guessing that the "mod_python-3.2.8.win32-py2.3.exe" I downloaded is incompatible with Python/2.3.5, Apache/2.0.58

Can anyone confirm this or let me know where i am going wrong?

Thanks in advance,
Jay.

This phrase is the

This phrase is the key:

Install the ActivePython version that corresponds to those SVN python bindings

I am pretty sure that you need Python 2.2.

Sorry, still no joy

Thanks for the prompt response Martin,
I tried ActiveState Python 2.2 - complained incorrect Python library (versions).

Also, the Subversion svn-win32-1.3.2 release README states:

These binaries were built with:
    Neon 0.25.5
    Berkeley DB 4.3.28
    OpenSSL 0.9.8
    ZLib 1.2.3
    Apache 2.0.54
    Python 2.3
    libintl 0.14.1 (patched)

mod_python with ActiveState Python 2.3.5 installs correctly and mptest.py and /mpinfo then both work normally. viewvc.py still same error message :(
As ViewVC.cgi works fine, i'll live with that.

However, I'd be interested to hear from anyone on WinXP platform that has managed to get SVN/1.3.2 Apache/2.0.54 (Win32) mod_python/3.2.8 Python/2.3.5 and viewvc-1.0.0 working with mod_python method.

PythonPath

It sounds like your PythonPath directive isn't correct. Is viewcvs.py in the folder pointed to by your PythonPath?

No viewcvs module Error

I am following your step by step guide, but when running the standalone py I receive the following error message:

C:\viewcvs-0.9.4>c:\Python23\python.exe standalone.py -g
Traceback (most recent call last):
  File "standalone.py", line 511, in ?
    import viewcvs
ImportError: No module named viewcvs

But the file viewcvs is inside the lib subdir

C:\viewcvs-0.9.4\lib>dir vie*
 Directory di C:\viewcvs-0.9.4\lib
16/03/2006  17.31            81.459 viewcvs.py
16/03/2006  17.31            74.333 viewcvs.pyc

Here the list of Sw installed:
SVN 1.3.0
Python 2.3.5
viewcvs 0.9.4 (download from tigris, because http://russ.hn.org/viewcvs is unavailable)

Have I done something wrong?
Thanks for your help

PYTHONPATH

You will need to set your PYTHONPATH environment variable to include the directory in which you installed ViewCVS (or ViewVC as it is now known). The Apache set up above does this in the Apache configuration file.

cannot get it to work...

While these were certainly the best instructions for installing ViewCVS with SVN on Windows, I tried it and cannot get it to work, I believe I made all the right moves, however, when testing the standalone.py, the browser return with message:

An Exception Has Occurred
Python Traceback

Traceback (most recent call last):
  File "C:\Program Files\viewcvs-1.0-dev\lib\viewcvs.py", line 3194, in main
    request.run_viewcvs()
  File "C:\Program Files\viewcvs-1.0-dev\lib\viewcvs.py", line 264, in run_viewcvs
    self.rootpath, rev)
  File "C:\Program Files\viewcvs-1.0-dev\lib\vclib\svn\__init__.py", line 322, in __init__
    self.repos = repos.svn_repos_open(rootpath, self.pool)
SystemError: null argument to internal routine

Using SVN 1.2.3, Python 2.3 + svn bindings, viewcvs from http://russ.hn.org/viewcvs/ (that url no longer responds) ... followed the instructions meticulously ... to no avail.

relevant viewcvs.conf lines:

svn_roots = mall: D:/svn/svn_repos/mall
root_parents = D:/svn/svn_repos : svn
default_root = mall

Anyone any ideas?

Harry

Bindings Problem?

This looks like a problem with the Python bindings to me. Did you install the SVN 1.2.3 binaries or build them yourself?

Setup experiences and simplification

Martin, this excellent guide got me started into the right direction. Please allow me to provide some feedback:

  • Get ViewCVS ...

    I downloaded CVS HEAD of viewcs from Sourceforge and seem to be able to use viewcvs quite successfully on Windows XP SP2, with Apache 2.0.54 and Python 2.3.

    The only issue I faced was a firewall between myself and Sourceforge, preventing direct CVS access. I "fixed" this by using CVSGrab to download the CVS repository data.

  • mod_python

    I fully realize the benefits of running using mod_python - but I am unable to find an "offical" build of mod_python for Python 2.3 and Apache 2.0.54 on Windows.

    With things being as they are, I have difficulties pushing "odd" things into the direction of those who will have to support the installation (and mod_auth_sspi already stretches that!). In the end, I decided to go the CGI route, reasoning that this

    • reduces system requirements (i.e. no mod_python)
    • simplifies my setup

    This approach reduces the paragraph "ViewCVS with Apache setup" above to

    Add the line ScriptAlias /viewcvs /www/cgi/viewcvs.cgi into the Apache httpd.conf file

Hope this helps
Stefan

Answers to some problems

ViewCVS with Apache setup:

  • I missed the modules/mod_python.so in my apache directory!

    Here is a link to binaries for the 2.4 version of python:

    http://www.modpython.org/pipermail/mod_python/2005-February/017486.html

    and here are the other versions:

    http://www.apache.org/dist/httpd/modpython/win/

  • I could not get the viewcvs.py program to work. It could be replaced with the cgi script instead! (the location lines seems to be removed from my posting but they should be in your config)
ScriptAlias /svn "C:\Program Files\viewcvs-1.0-dev\www\cgi\viewcvs.cgi"
<location /svn>
   AddHandler python-program .py
   PythonPath "['C:\Program Files\viewcvs-1.0-dev\lib']+sys.path"
   PythonHandler apache
   PythonDebug On
   AddDefaultCharset UTF-8
</location>

Otherwise these howto's are very good, saved me a lot of time! Many thanks! /Anders H.

Python Version

The Subversion bindings only work with Python 2.3, try that version.