Issue #9516: Change distutils to no longer globally attempt to check and
set the MACOSX_DEPLOYMENT_TARGET env variable for the interpreter process
on OS X.  This could cause failures in non-distutils subprocesses and was
unreliable since tests or user programs could modify the interpreter
environment after distutils set it.  Instead, have distutils set the
the deployment target only in the environment of each build subprocess.

Continue to use the previous algorithm for deriving the deployment target
value:
    if MACOSX_DEPLOYMENT_TARGET is not set in the interpreter's env:
        use the interpreter build configure MACOSX_DEPLOYMENT_TARGET
    elif the MACOSX_DEPLOYMENT_TARGET env value >= configure value:
        use the env MACOSX_DEPLOYMENT_TARGET
    else: # env value less than interpreter build configure value
        raise exception
This allows building extensions that can only run on newer versions of
the OS than the version python was built for, for example with a python
built for 10.3 or later and an extension that needs to be built for 10.5.
2 files changed