[Python-Dev] Proposed Mac OS X change for 2.3.5 and 2.4.1 - MACOSX_DEPLOYMENT_TARGET vs. Python, round two, fight! (original) (raw)

Bob Ippolito bob at redivi.com
Fri Dec 10 02:17:21 CET 2004


I've included a lot of background information here, if you just want to know the details of the proposed change, skip to the bottom.

As some of you may know, Python 2.4's configure script and distutils has some tricky behavior with regard to the MACOSX_DEPLOYMENT_TARGET environment variable on Mac OS X 10.3 and later. Unless otherwise specified, assume that I am talking about a build environment of Mac OS X 10.3 or later. This behavior is as follows:

If MACOSX_DEPLOYMENT_TARGET is not set during configure:

  1. distutils builds modules with -F/Python/Installation/Location -framework Python as per usual 2.3.x behavior if it is also not set
  2. If MACOSX_DEPLOYMENT_TARGET is set during a later run of distutils, then distutils complains that "10.3" mismatches the configure time setting of ""

This Python framework has the following misfeatures:

  1. All your extensions are dependent on the installation location of this particular Python
  2. This installation of Python 2.4 may break the building of extensions for any previous version of Python that uses the same distutils behavior. It will certainly break them if they are installed to the same framework directory, but if the version of Python 2.3 is early enough, such as the stock 2.3.0, it will break that too. Also, any future version of Python installed to the same frameworks directory will break the building of extensions for this Python installation!
  3. The Python framework will not be compatible with versions of Mac OS X earlier than 10.3 anyway due to changes in libSystem!

This is stupid, and it should NOT be default behavior!

If MACOSX_DEPLOYMENT_TARGET is set to "10.3" or higher during configure:

  1. distutils builds modules with -undefined dynamic_lookup
  2. If MACOSX_DEPLOYMENT_TARGET is set to something other than "10.3", or unset, it will complain that the current setting mismatches the configure setting of "10.3"

The features:

  1. All your extensions are independent of the Python installation location, and are thus compatible with any other Python with the same major version.
  2. This installation of Python 2.4 will still, unavoidably, break the building of extensions for any previous version of Python using the bad distutils behavior mentioned above. This installation is not susceptible to breakage, however.

The misfeatures:

  1. You need to have MACOSX_DEPLOYMENT_TARGET set during configure, most people don't know to do this.
  2. You also need to have MACOSX_DEPLOYMENT_TARGET set when using distutils. Even less people know to do this.

The solution to this is to have the following behavior instead:

  1. If no MACOSX_DEPLOYMENT_TARGET is set during configure, and the build machine is Mac OS X 10.3 or later, then set it to "10.3".
  2. If no MACOSX_DEPLOYMENT_TARGET is set during distutils, but it WAS set during configure, then set it to the configure time value.
  3. Otherwise, if it is set to a LOWER value, then fail. Checking for an exact match is bad, because the user or extension author should be free to build a particular extension using 10.4 specific features against a Python that is 10.3+ compatible.

For a build machine running Mac OS X 10.2 or earlier, it should ignore all of this behavior as per usual.

Unless anyone has a reasonable objection to this proposed solution, then we should make sure it goes into Python 2.4.1 and Python 2.3.5.

These threads might also be of interest: http://mail.python.org/pipermail/pythonmac-sig/2004-November/012192.html http://mail.python.org/pipermail/pythonmac-sig/2004-December/012237.html http://mail.python.org/pipermail/pythonmac-sig/2004-December/012275.html

-bob



More information about the Python-Dev mailing list