WAMP Installation notes

Binaries and requirements used in setup:

Written by a newbie, for newbies.
Versions specified are the versions used when writing this tutorial and may not reflect current versions available.

INCOMPLETE - Need to finish.

Special thanks to djc for all the help in IRC.

WAMP 2.0c

Python 2.5.2 (32 bit)

mod_python v3.3.1 (win32) (py2.5) (Apache2.2)

Python Win32 API (py2.5)

Mercurial v1.01

Installation Steps

1. Install WAMP if not already installed.

2. Install Python 2.5 if not installed.

3. Install mod_python.

4. Install Python Win32 API

5. Install Mercurial Binaries

6. Extract <MercurialPath>\library.zip to <MercurialPath>\lib

7. Create 'hg' dir in <WAMPPath>\www

8. Download modpython_gateway.py and install to <Python Path>\Lib\site-packages

9. Download hgwebdir.cgi and place in <MercurialPath> (One doesn't come in the binary package unless I missed it)


# An example Python script to export multiple hgweb repos, edit as necessary

# Add a python path if mercurial is not a system-wide install:
#import sys
#sys.path.insert(0, "<MercurialPath>\lib")

# Changes Python Working path to support collections in windows with mod_python
#import os

# enable importing on demand to reduce startup time
from mercurial import demandimport; demandimport.enable()

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb

# If you'd like to serve pages with UTF-8 instead of your default
# locale charset, you can do so by uncommenting the following lines.
# Note that this will cause your .hgrc files to be interpreted in
# UTF-8 and all your repo files to be displayed using UTF-8.
#import os
#os.environ["HGENCODING"] = "UTF-8"

from mercurial.hgweb.hgwebdir_mod import hgwebdir
#import mercurial.hgweb.wsgicgi as wsgicgi

# The config file looks like this.  You can have paths to individual
# repos, collections of repos in a directory tree, or both.
# [paths]
# virtual/path = /real/path
# virtual/path = /real/path
# [collections]
# /prefix/to/strip/off = /root/of/tree/full/of/repos
# collections example: say directory tree /foo contains repos /foo/bar,
# /foo/quux/baz.  Give this config section:
#   [collections]
#   /foo = /foo
# Then repos will list as bar and quux/baz.
# Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
# or use a dictionary with entries like 'virtual/path': '/real/path'

application = hgwebdir('hgweb.config')

10. Create <WAMPPath>\alias\hg.conf with the following contents:


<Location /hg>

PythonPath "sys.path + [ '<MercurialPath>' ]"
#PythonDebug On
#Uncomment this line if you got a problem and need debug information
SetHandler mod_python
PythonHandler modpython_gateway::handler
PythonOption SCRIPT_NAME /hg
PythonOption wsgi.application hgwebdir::application


11. Create <MercurialPath>\hgweb.conf

Here is an example for a configuration containing collections in a directory called 'repos' which is a subdirectory of my Mercurial install (Which I set to be my Python Working Directory in hgwebdir.py).


[collections] repos\ = repos/

12. Restart Apache

Installation Notes


# Add a python path if mercurial is not a system-wide install:
#import sys
#sys.path.insert(0, "<MercurialPath>\lib")

Uncommenting the last 2 lines here will add another path that Python will search.
Necessary for this install.
Not necessary if you compiled from source and did a global install.

# Changes Python Working path to support collections in windows with mod_python
#import os

Uncommenting the last two lines here will forcibly change the Python working directory.
This is probably necessary for any Mercurial install on windows that uses mod_python, unless your repositories are located in a sub dir of <PythonPath>\Lib\site-installs which I don't think anyone in their right mind would do.


Make sure this is commented out or deleted, in the raw file it is not and will error you out.


Some errors will appear in appache error log, they can be ignored:





WAMPInstall (last edited 2012-11-11 11:37:41 by abuehl)