I decided tonight was the night to try Python2.6a3 on my macbook pro with a goal of getting pysmug to run on it.

After downloading and doing the typical configure && make dance I saw this:

Failed to find the necessary bits to build these modules:
bsddb185          gdbm              linuxaudiodev
ossaudiodev       readline          spwd
sunaudiodev

Apparently setup.py won't build the readline module with the stock readline library on my mac. I already installed libreadline from MacPorts so I applied the following patch:

diff -r c68686a4d0b2 setup.py
--- a/setup.py  Thu May 15 21:06:32 2008 -0700
+++ b/setup.py  Thu May 15 21:49:39 2008 -0700
@@ -298,6 +298,8 @@
         # Ensure that /usr/local is always used
         add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
         add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+        add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib')
+        add_dir_to_list(self.compiler.include_dirs, '/opt/local/include')

         # Add paths specified in the environment variables LDFLAGS and
         # CPPFLAGS for header and library files.

This worked. After installing the rest of the required pysmug dependencies (simplejson, nose, setuptools, pycurl) I was able to build pysmug. Running the tests resulted in the following error:

  File "…/nose-0.10.2-py2.6.egg/nose/suite.py", line 377, in makeSuite
self.context.setdefault(suite, []).append(context)
TypeError: unhashable type: 'ContextSuite'

It turns out this issue already has a patch. After applying it and re-[compiling,installing] I tried again. Success!

performance

Out of curiosity I tried two runs each of 2.5 and 2.6, interlaced.

$ python2.6 setup.py nosetests
Ran 9 tests in 10.654s
$ python2.5 setup.py nosetests
Ran 9 tests in 12.128s
$ python2.6 setup.py nosetests
Ran 9 tests in 11.413s
$ python2.5 setup.py nosetests
Ran 9 tests in 12.207s

In this extremely unscientific test it appears 2.6 has the edge. I wouldn't read very much into this.

Categories: development 
Tags: osx  pysmug  python 
comments powered by Disqus