views:

215

answers:

1

I'm trying to compile a variety of python extensions (pycrypto, paramiko, subvertpy...) on Mac OS X 10.6, such that they will be compatible with Mac OS X 10.5 and its built-in python 2.5, for including in a product installer targetted at Mac OS X 10.5.

I'm really not sure how to go about this. I dug around on Google and found a question here on stackoverflow, which led me to setting MACOSX_DEPLOYMENT_TARGET=10.5 in my environment before building, but that just gave me the error:

distutils.errors.DistutilsPlatformError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.5" but "10.6" during configure

I am using python2.5 on Mac OS X 10.6 to run the builds, for example:

$ python2.5 setup.py install

I also came across references to /Developer/SDKs/MacOSX10.5.sdk but I'm not really sure how to make use of it.

A: 

I managed to get distutils to believe that Python was built on Leopard, by inserting the following code before the call to setup() in setup.py:

# XXXHACK: make distutils believe that Python was built on Leopard.
from distutils import sysconfig
their_parse_makefile = sysconfig.parse_makefile
def my_parse_makefile(filename, g):
    their_parse_makefile(filename, g)
    g['MACOSX_DEPLOYMENT_TARGET'] = '10.5'
sysconfig.parse_makefile = my_parse_makefile

Then pycrypto builds well on Snow Leopard, using python2.5, after setting MACOSX_DEPLOYMENT_TARGET to "10.5". I can't guarantee it will work well but pycrypto's bundled test suite passed with this build on my Macbook Air running Leopard, so it seems OK.

fraca7