# Building pysvn Extension

## Prerequisites

To build pysvn you will require:

- Python 2.7 or 3.5 or later with these options:
  - Python runtime package
  - Python development package
  - Python pyexpat package
- subversion 1.9.x or later with these options:
  - Subversion client package
  - Subversion development package
- PyCXX V7.1.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++ to compile the code and INNO 5 to create the installation kit.

1. Build subversion
2. Fetch and expand the pysvn source code into extdir
3. Expand pycxx-7.1.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\Windows`
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-7.1.4.tar.gz` into extdir/Import if not using a source kit
4. `cd Source`
5. Create the Makefile using `python setup.py configure`
6. `make`
7. `cd Tests`
8. 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`