Menu

PyHook_Build_Instructions

nanotube

Introduction

The instructions here are for those who want to build pyHook from source (otherwise, you can just use the existing binary release and not worry about any of this).

System requirements

  • Windows 2000 or later.
  • Python 2.5 or later
  • MinGW (Minimalist GNU for Windows). Use the Automated MinGW Installer. Don't forget to add the MinGW bin directory to your PATH when the install is done. At a minimum you need:
    • gcc-core
    • gcc-g++
    • binutils
    • runtime
    • utils
    • w32api
  • Optionally you can use Cygwin instead of MinGW, the build process is identical.
  • SWIG, download the latest development version (1.3 branch), put the path with the swig.exe into your PATH.

Build process

Once you have all the required software installed, you are ready to build pyHook. First, of course, you have to pull the actual pyHook code. Either get the latest source release, or pull from the CVS repository using your favorite CVS client.

Then, cd to the directory where you stored PyHook source, and run the build command:

python setup.py build -cmingw32

This command will automatically do the following:

  • Run SWIG to wrap your .c extension with necessary code.
  • Run GCC to compile your extension and the wrapper code.
  • Link compiled code to Python libraries and create the .pyd file. (reference)

Once that is done, you may wish to create a redistributable extension installer executable. To do that, all you need to do is run the following command (still from inside the directory where you stored PyHook code):

python setup.py bdist_wininst

And you are done. You can then use the installer you just generated to install the version of pyHook that you just built.


Related

Wiki: Main_Page