GHOP's Issue #84 - Jabber Bot on Windows

Index

This document is based on MoinMoin's issue #84 at Google's Highly Open Participation Contest. The goal is to successfully set up and run the Jabber notification bot present on moin/1.7 development branch on Windows. This document is based on Windows XP Professional, but shall apply to any recent Windows x86 platform. Administration privileges were used during setup.

Setting up the environment

Cygwin

Cygwin is a Linux-like environment for Windows. By providing a Linux API emulation layer, most packages can be compiled from source under Windows. This has it's advantages (easy to set up) and disadvantages (dependency on cygwin1.dll, the emulation layer) , but for this setup, it was chosen. The simplest way to install and maintain a cygwin environment is using the setup.exe provided by it. Be sure to mark the following packages for installation on setup.exe, and accept any unmet dependencies found:

Full Base

Devel: autoconf, automake, binutils, gcc, libxml2, libxml2-devel, make

Python: python, asciidoc, pylibxlm2, python-libxml2

Net: openssl

Libs: libxml2, openssl-devel

Subversion

Subversion is a version control system for source repositories aimed to replace CVS. This will be needed to retrieve the latest versions of pyxmpp and m2crypto later. You can download it's Windows binary here.

Mercurial

Mercurial is a fast, lightweight source control management system. Another tool for source repositories needed to retrieve MoinMoin's moin/1.7 development branch. For preventing a second Python environment, outside Cygwin, the "all in one" approach is preferable. Download it here.

PATH

And, to conclude this section, we must add some directories to the system's PATH variable. Subversion adds it's path by default, setting it again is not necessary. Mercurial should also do it by default. Anyway, right click the "My Computer" icon and click "Properties". In the new window, click on the "Advanced" tab, then click the "Environment Variables" button. Highlight the "PATH" variable in "Systems Variable" and click edit. Add the following to the end of it, assuming a default install was done:

;C:\Mercurial;C:\cygwin\bin;C:\cygwin\usr\bin;C:\cygwin\usr\local\bin

Edit the above accordingly if any installation directory differs from the default.

Downloading

The base environment is already set up. The next step is to download the sources necessary for this setup. Every source will be available under "C:\" on this document.

SWIG

SWIG stands for "Simplified Wrapper and Interface Generator". This tool connects programs in C and C++ with a variety of high level programming languages, including Python. Version 1.3.30 or newer is needed for this setup. Download the .tar.gz here. On this document, the tarball was extracted to "C:\".

dnspython

dnspython is a DNS toolkit for Python, providing both low and high level access to DNS. Yet it's important to prevent developers from reinventing the wheel, it can be a bit tricky. Both dnspython 1.6.0 and HEAD will work, but there's a catch: versions above 1.3.x do not mention a lacking resolv.conf under Cygwin. For consistency, the 1.6.0 stable tarball will be used on this setup. Download it here. It was extracted to "C:\".

Mass checkout: pyxmpp, m2crypto, MoinMoin

Now, using svn and hg, let's download the latest source code available for the packages we will need on this setup:

C:\> svn checkout http://pyxmpp.jajcus.net/svn/pyxmpp/trunk pyxmpp

C:\> svn co http://svn.osafoundation.org/m2crypto/trunk m2crypto

C:\> hg clone http://hg.moinmo.in/moin/1.7 moin-1.7

Installing the packages

This is pretty straightforward if the needed packages were downloaded on Cygwin's setup.exe and if the paths were set up accordingly:

SWIG

C:\> cd swig*

C:\swig-1.3.33> sh

$ ./autogen.sh

$ ./configure

$ make

$ make install

$ exit

C:\swig-1.3.33> cd ..

dnspython

C:\> cd dnspython-1.6.0

C:\dnspython-1.6.0> sh

$ python setup.py build

$ python setup.py install

exit

C:\dnspython-1.6.0> cd ..

M2Crypto

C:\> cd m2crypto

C:\m2crypto> sh

$ python setup.py build

$ python setup.py install

$ exit

C:\m2crypto> cd ..

pyxmpp

C:\> cd pyxmpp

C:\pyxmpp> sh

$ ./configure.py

$ make

$ make install

$ exit

C:\pyxmpp> cd ..

MoinMoin

NOTE: According to HelpOnInstalling/BasicInstallation, you may set up a PREFIX when installing MoinMoin. In this case, do not forget to edit sys.path as necessary to include it's path!

C:\> cd moin-1.7

C:\moin-1.7> sh

$ python setup.py build

$ python setup.py install

$ cd /usr/share/moin

$ tar xjf underlay.tar.bz2

$ exit

C:\moin-1.7> cd ..

Then proceed as usual with HelpOnInstalling/WikiInstanceCreation to set up a wiki.

Setting up the notification bot

Now, to the scope of this document: let's set up the Jabber notification bot itself...

A "fake" resolv.conf

Remember about dnspython being picky? So, setting up first a "fake" resolv.conf is needed to make DNS requests work. This is actually simple: "ipconfig /all" can show us the DNS servers. Just copy it to /etc/resolv.conf:

C:\> sh
$ ipconfig /all

(output snipped)

        DNS Servers . . . . . . . . . . . : 200.246.xxx.xxx
                                            200.189.xxx.xxx

$ echo "200.246.xxx.xxx" >> /etc/resolv.conf

$ echo "200.189.xxx.xxx" >> /etc/resolv.conf

$ echo "search" >> /etc/resolv.conf

The Bot

Finally, set up the bot itself. Two steps are needed for this: copy the "jabberbot" directory from MoinMoin's source repository, and then create a symbolic link from Python's package directory pointing to it:

C:\> sh

$ cp -R moin-1.7 jabberbot

$ ln -s jabberbot/ /usr/lib/python2.5/site-packages/jabberbot

And you are done! The notification bot now should work on Windows under Cygwin, like it works under Linux. Just set the bot's configuration, such as username, password, and server, on config.py. Do not forget do allow xmlrpc ( actions_excluded = [] ), and add notification_bot_uri and secret options to your wikiconfig.py. More information can be found on MoinMoinTodo/Release 1.7/HelpOnNotification.

MoinMoin: JabberBotOnWindows (last edited 2008-11-02 22:26:21 by ThomasWaldmann)