Tuesday, March 22, 2011

Building the Scavenger Python library

This is the second "building scavenger" post -- see the post immediately before this one for a description of how to build the Scavenger daemon. In this post I will describe how you can install the Scavenger Python library on a client device, so that you may start offloading tasks to your Scavenger daemon instance.

When installing the Scavenger library you designate a Python interpreter that you wish to install the Python modules into, so the first dependency is of course Python. Secondly, the script building the library uses git to fetch the source code from GitHub, so git is a dependency too.

Once you have these two dependencies installed, building and installing the Scavenger library (on a Mac or Linux machine) is as simple as 1) downloading this script, and 2) running the script with the path to the chosen Python interpreter as an argument.
$ wget https://github.com/madsdk/scavenger-library/raw/master/build/build_and_install.sh
$ sh build_and_install.sh /usr/bin/python
If you have any questions about getting Scavenger to run on your system, please don't hesitate to contact me. The best thing to do is to leave a comment on this page, but you are also welcome to send me a mail.

Building the Scavenger daemon

I recently moved the development of Scavenger onto GitHub. In that process I created two build scripts: One for building the Scavenger daemon on a Linux or Mac machine, and another for building and installing the Scavenger library on the same platforms. In this post I will describe the installation of the Scavenger daemon.

In order to build the Scavenger daemon, you need to install a couple of dependencies. You need git, the gcc compiler and, in order to compile the Presence daemon used for discovery, you also need to install the Qt SDK. If you are on a Mac, getting gcc installed means that you should install Xcode and getting git installed can e.g., be done using MacPorts.

After having installed these dependencies building the Scavenger daemon is as simple of downloading and running the Mac script or the Linux script. The script should be downloaded to and run from the folder in which you would like to build the Scavenger daemon. When run it will download and build Stackless Python, checkout and build the relevant GitHub projects, and configure a Scavenger daemon instance.

After having successfully run the build script, you can start a Scavenger daemon instance by entering the scavenger_daemon directory and running the start_daemon.sh script.

If you have any questions about getting Scavenger to run on your system, please don't hesitate to contact me. The best thing to do is to leave a comment on this page, but you are also welcome to send me a mail.

Wednesday, March 2, 2011

Building PyGTK for Mac

In the past couple of months a number of people have asked me to provide new native Mac PyGTK builds. I do not use PyGTK anymore, so I don't have time to maintain these builds - sorry. Out of curiosity I recently built PyGTK on my Snow Leopard (10.6.6) machine, just to see if the process has gotten any easier, and I must say that it has. I was able to build the entire thing without any hacking. So, to those of you asking me to provide new builds, here you have a complete HOWTO of how to build a native Mac PyGTK:

  1. Create a new user account (to make sure that no MacPorts/Fink/other libraries are available in the environment)

  2. Install git (http://code.google.com/p/git-osx-installer/downloads/list?can=3)

  3. Log in to the new account (I ssh'ed in from a Terminal)

  4. Download the build script (https://github.com/jralls/gtk-osx-build/raw/master/gtk-osx-build-setup.sh)

  5. Add ~/.local/bin to PATH

  6. Edit ~/.jhbuildrc-custom setting setup_sdk like so: setup_sdk(target="10.6", sdk_version="10.6", architectures=["i386"])

  7. Run these build commands:

    1. $ jhbuild bootstrap

    2. $ jhbuild build meta-gtk-osx-bootstrap

    3. $ jhbuild build meta-gtk-osx-core

    4. $ jhbuild build pygtk



  8. Download the PyGTK hello world script (http://www.pygtk.org/pygtk2tutorial/examples/helloworld.py)

  9. Update your PYTHONPATH: export export PYTHONPATH=$PYTHONPATH:~/gtk/inst/lib/python2.6/site-packages

  10. Make sure that 32-bit Python is used: export VERSIONER_PYTHON_PREFER_32_BIT=yes

  11. Test your build by running the hello world script: python helloworld.py


Note that to perform the last step you need to be properly logged in (not just through SSH).

I hope that this helps some of the people that have asked me about PyGTK builds. Happy hacking ;-)