?

Log in

No account? Create an account

Python on OS X 10.5 Leopard

« previous entry | next entry »
Feb. 28th, 2008 | 05:14 pm

I was trying to run the subversion plugin for bazaar, and ran into a confusing problem with python on OS X 10.5.

It turns out that there's already a copy of the python svn interface in /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python and when I added a python .pth file to my upgraded subversion install in the "offical" local install location of /Library/Python/2.5/site-packages' it didn't work.

The relevant parts of the default 10.5 python sys.path look like:

'/Library/Python/2.5/site-packages/readline-2.5.1-py2.5-macosx-10.5-i386.egg',
'/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python',
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload',
'/Library/Python/2.5/site-packages',
'/usr/local/svn-1.5.0-dev/lib/svn-python',

So the vendor version in Extras was first, no wonder it didn't work.

However, packages I installed via leopard's easy_install were way up at the head of sys.path, that seems interesting.

$ cat /Library/Python/2.5/site-packages/easy-install.pth
import sys; sys.__plen = len(sys.path)
./readline-2.5.1-py2.5-macosx-10.5-i386.egg
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)


Those import lines look promising, and placing them into my custom .pth bumped my version of the svn library up above the version lurking in Extras.

Link | Leave a comment | Share

Comments {0}