wiki:RunningBuildbotWithVirtualEnv

 virtualenv is a really handy Python tool that builds "sandboxes" where you can install all the Python modules you want, without affecting your system's Python. Here's how to use it to develop Buildbot.

Getting Started

First, get virtualenv installed. You'll need to install this in your system's site-packages, but it's easy. If your package manager provides a way to do this, use it instead.

sudo easy_install virtualenv

Set yourself up a working directory with a sandbox and some source

mkdir buildbot-work
cd buildbot-work
git clone git://github.com/buildbot/buildbot.git src
virtualenv sandbox

Activate the sandbox

source sandbox/bin/activate

or on Windows

sandbox\Scripts\activate

(you should see a (sandbox) prefixed to your shell prompt)

Install buildbot with the 'develop' option so that you can hack on the active code

cd src
pip install -e master
pip install -e slave

Install mock so you can run unit tests

pip install mock

For patch development, you may also want sphinx (to build docs) and pyflakes (for static analysis of new patches)

pip install sphinx
pip install pyflakes

Note: On windows it's necessary to install win32api as well, download from  here the latest executable appropriate for your system, and then within the sandbox run:

easy_install <executable_name>

Hacking

If necessary, re-activate your sandbox (see above).

Hack away. To run unit tests:

cd src
trial buildbot.test buildslave.test

Note: On Windows, you give search path to trial

Running

To run buildbot, you'll need to go through the usual buildbot setup process. First, make sure your sandbox is active (see above). Then set up a master directory:

Master

cd sandbox
buildbot create-master master

create and edit master/master.cfg up to your liking, then, to start the buildmaster,

buildbot start $VIRTUAL_ENV/master

or, if you want to run it in the foreground,

twistd --nodaemon --no_save -y $VIRTUAL_ENV/master/buildbot.tac

Slave

If you're using the sample config:

  • host: localhost:9989
  • name will be "example-slave"
  • password is in the sample config ("pass").
    buildslave create-slave slave localhost:9989 example-slave pass
    

Then start it in the background with

buildslave start $VIRTUAL_ENV/slave

or in the foreground with

twistd --nodaemon --no_save -y $VIRTUAL_ENV/slave/buildbot.tac