Michal Čihař - PyGtk in virtualenv on Travis

PyGtk in virtualenv on Travis

Weblate is using Travis CI for continuous integration. That in turn uses virtualenv to test against different Python version.

Unfortunately one of dependencies in Weblate are PyCairo and PyGtk (actually Pango for text rendering) and these does not support installation using distutils. Fortunately this can be workarounded, but it took me some time to make all this properly. Ffirst you need to choose correct versions not as I did mistakenly mixed PyGObject 3 with PyGtk 2. The next step is to manually run configure and make with correct paths to install within virtualenv.

For example for Gtk it looks like following:

wget http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.24/pygtk-2.24.0.tar.bz2
tar xf pygtk-2.24.0.tar.bz2
cd pygtk-2.24.0
export PKG_CONFIG_PATH=/home/travis/virtualenv/python$TRAVIS_PYTHON_VERSION/lib/pkgconfig
./configure --prefix=/home/travis/virtualenv/python$TRAVIS_PYTHON_VERSION/
make
make install

The complete Travis configuration file can be found in Weblate's Git repository.