How to compile python extensions for Mac OS X 10.5 on Mac OS X 10.6?

I am trying to compile many python extensions (pycrypto, paramiko, subvertpy ...) on Mac OS X 10.6 so that they are compatible with Mac OS X 10.5 and built-in python 2.5 including in the product installer configured on Mac OS X 10.5.

I'm really not sure how to do this. I dug up on google and found https://stackoverflow.com/a/16626932/ which has led me to set MACOSX_DEPLOYMENT_TARGET = 10.5 in my environment before creating, but this just gave me an error:

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

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

$ python2.5 setup.py install

I also came across links to / Developer / SDKs / MacOSX 10.5.sdk, but I'm not sure how to use it.

+3
source share
1 answer

I managed to make distutils believe that Python was built on Leopard by inserting the following code before calling 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 works well on Snow Leopard using python2.5, after setting MACOSX_DEPLOYMENT_TARGET to "10.5". I cannot guarantee that it will work well, but the pycrypto suite of test suites went with this build on my Macbook Air running Leopard, so everything seems to be in order.

+1
source

Source: https://habr.com/ru/post/1746309/


All Articles