Friday, December 19, 2008

PyGTK natively on Mac

I recently found out that the GTK+ GUI widget set had been ported to run natively (i.e. without the use of X11) on Mac OS X. Information about this project can be found on this page. Now, I like GTK+ but life is too short to be coding in C, so I imediately started looking into the possibility of using PyGTK together with this native Mac version of GTK+ and that is indeed possible. To get a fully functional version of GTK+ and PyGTK installed onto your Mac follow the instructions on Imendio's page and then after finishing the installation add the following command:
jhbuild build pygtk

This will build libglade, pygtk, pycairo and some other stuff and install the necessary files into your site-packages folder of your local Python.

Building all of this from source is a lengthy process, and I have therefore created a .dmg image (Intel or PPC) of a GTK+-with-PyGTK that you may use as a shortcut :-) Using this approach will give you a fully functional native PyGTK to play with in less than two minutes.

Friday, December 5, 2008

Building PythonCE from source

I have recently had the need to compile PythonCE from source, which turned out to be a quite complex task. Therefore I have decided to write this blog post, so that others may avoid wasting the many hours that I wasted trying to get it to build.

My setup for building PythonCE was this: Windows XP SP2, Microsoft eMbedded Visual C++ 4 with SP4, Pocket PC 2003 SDK, and Python 2.5.

To actually build the thing you need to download the PythonCE source, unzip it, enter the PCBuild/WinCE directory, and typing “scons”. This failed on my machine though, which I later found was due to a missing registry key in my Pocket PC 2003 SDK install (or something of the likes). To get it to compile i edited the file PCbuild/WinCE/msevc.py and made a small correction to the get_msevc_paths function - this is shown below. The addition I made was in the except-clause, where I manually set the exe_path.



def get_msevc_paths(env):
...
try:
value, value_type = SCons.Util.RegQueryValueEx(hkey, 'Path Dirs')
exe_path = str(value.decode('utf_16_le').rstrip(u'\x00'))
except (SCons.Util.RegError, SCons.Errors.InternalError):
exe_path="C:\\Program Files\\Microsoft eMbedded C++ 4.0\\"\
"EVC\\wce420\\bin;C:\\Program Files\\"\
"Microsoft eMbedded C++ 4.0\\Common\\EVC\\Bin"