# Building pysvn Extension

## Prerequisites

To build pysvn you will require:

- Python 2.6 or later with these options:
  - Python runtime package
  - Python development package
  - Python pyexpat package
- subversion 1.7.x or 1.8.x with these options:
  - Subversion client package
  - Subversion development package
- PyCXX V6.2.4 to build against Python 2 or Python 3 which is included in the pysvn source kit.

Some distributions will split python and subversion into more the one package.

You will need to find all the packages that give you the options listed above.

### Building on win32

PYSVN sources have been updated to build on Windows 7 64bit version. Expect issues on older windows and 32but windows.

These instructions assume you have Microsoft Visual C++ 2008 (9.0) to compile the code and INNO 5 to create the installation kit.

You must build with MSVC 2008 (9.0) for Python 2.6 or later and python 3.0 or later.

1. Build subversion (tested with and svn 1.7.11 and 1.8.1)
2. Fetch and expand the pysvn source code into extdir
3. Expand pycxx-6.2.4.tar.gz into extdir\Import if not using a source kit
4. Edit Builder\builder_custom_init.cmd to match the locations of the sources.
5. `cd Builder`
6. `builder_custom_init.cmd`
7. `cd ..\Source`
8. `python setup.py configure ...` (add any configure options required to make it find the required libraries).
9. `nmake`
10. `cd ..\Test`
11. `nmake`
12. `cd ..\Kit\Win32-1.7`
13. `nmake`

To install the built kit

1. Uninstall any previous kit (control panel's Add/Remove programs)
2. `nmake -f win32.mak install`

### Building on unix and Mac OS X systems.

1. Install subversion.
   When installing from packages you will need to install the devel packages as well. For example on Fedora/Redhat subversion-devel, apr-devel, apr-util-devel and their dependancies.
2. Get the pysvn source code
3. For Python 2 or Python 3 builds: `tar xzf pycxx-6.2.4.tar.gz` into extdir/Import if not using a source kit
4. `cd Source`
5. For Python 2.6 or earlier builds: backport the PySVN code using `python setup.py backport`
6. Create the Makefile using `python setup.py configure`
7. `make`
8. `cd Tests`
9. Test pysvn by running `make`

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`