This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.3" but "10.5" during configure
Type: behavior Stage: resolved
Components: Distutils, Distutils2, macOS Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: alexis, benjamin.peterson, eric.araujo, flox, georg.brandl, kontinuity, ned.deily, python-dev, ronaldoussoren, srid, stoneyb, tarek
Priority: release blocker Keywords: patch

Created on 2010-08-04 20:59 by srid, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue9516.patch ronaldoussoren, 2010-09-16 15:33
issue9516-v2.patch ronaldoussoren, 2011-05-07 06:34 review
issue9516-v2-python2.7.patch ronaldoussoren, 2011-05-14 06:28
darwin-target-sysconfig-p7g.diff eric.araujo, 2011-06-03 16:14 review
issue9516_v3_test_distutils.patch ned.deily, 2011-06-13 21:13 3.3 and 3.2 patch for test_distutils
issue9516_v3_distutils.patch ned.deily, 2011-06-13 21:14 3.3 and 3.2 patch for distutils review
issue9516_v3_test_distutils_27.patch ned.deily, 2011-06-13 21:14 2.7 patch for test_distutils
issue9516_v3_distutils_27.patch ned.deily, 2011-06-13 21:15 2.7 patch for distutils
issue9516_v3_test_packaging.patch ned.deily, 2011-06-13 21:15 3.3 patch for test_packaging
issue9516_v3_packaging.patch ned.deily, 2011-06-13 21:16 3.3 patch for packaging
Messages (32)
msg112892 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-08-04 20:59
I cannot find correct repro steps for this, but:

/Library/Frameworks/Python.framework/Versions/2.7/bin/python" -B -s -c "import sys;print('%d.%d' % tuple(sys.version_info)[:2])
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 558, in <module>
    main()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 540, in main
    known_paths = addusersitepackages(known_paths)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 264, in addusersitepackages
    user_site = getusersitepackages()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 239, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 229, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 518, in get_config_var
    return get_config_vars().get(name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 421, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 300, in _init_posix
    raise IOError(msg)
IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.3" but "10.5" during configure

Python was built on a Snow Leopard machine with MACOSX_DEPLOYMENT_TARGET=10.5 environment variable. But on the user's 10.6 machine, no such environment variable is necessarily set.

Why is this check required? Shouldn't it be restricted to building modules using distutils, and not happen during an innocuous "import site" that happens in interpreter startup?
msg113161 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-08-07 10:10
I agree that this behavior wrong, this should only trigger an error when building packages.

How did you build python? I guess something like this:

$ export MACOSX_DEPLOYMENT_TARGET=10.5
$ configure --enable-framework
$ make install

This should result in getting the right deployment target into config/Makefile, which means there may be two bugs here:

1) sysconfig.get_config_vars shouldn't trigger and error, only 
   the distutils build command should do that

2) config/Makefile should always contain the value of MACOSX_DEPLOYMENT_TARGET as used during the build, which in turn should
mean the value during the configure step.

BTW. I tend to configure like this:

$ configure --enable-framework MACOSX_DEPLOYMENT_TARGET=10.5

That way automatic reruns of configure pick up the right environment variables.
msg113474 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-08-09 21:10
We build ActivePython 2.7 on Mac as follows:

   $ export MACOSX_DEPLOYMENT_TARGET=10.5
   $ ./configure --enable-framework --enable-universalsdk=/Developer/SDKs/MacOSX10.5.sdk/ --with-universal-archs=intel
   $ make

(the environment variable is also used by other builds)

We explicitly specify the SDK path here because the build happens on a 10.6 machine (to ensure that tkinter is built for 64-bit arch). Also, we explicitly drop PPC support.
msg113606 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-08-11 15:40
Assigning to myself because I intend to work on this.

More questions: does the error occur on the 10.6 machine you used to do the build or another machine?

Is MACOSX_DEPLOYMENT_TARGET set in the environment when you run the command that gives the error message?
msg113632 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-08-11 22:08
Another machine.
> Is MACOSX_DEPLOYMENT_TARGET set in the environment when you run the command that gives the error message?
I don't think I had this environment set when I saw the above error 
message. I had to set MACOSX_DEPLOYMENT_TARGET=10.5 in order to 
workaround it though.

BTW, I just figured that following command will reliably reproduce this 
issue:

$ MACOSX_DEPLOYMENT_TARGET=10.3 python2.7 -B -s -c "import 
sys;print('%d.%d' % tuple(sys.version_info)[:2])"
Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", 
line 558, in <module>
     main()
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", 
line 540, in main
     known_paths = addusersitepackages(known_paths)
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", 
line 264, in addusersitepackages
     user_site = getusersitepackages()
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", 
line 239, in getusersitepackages
     user_base = getuserbase() # this will also set USER_BASE
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", 
line 229, in getuserbase
     USER_BASE = get_config_var('userbase')
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", 
line 518, in get_config_var
     return get_config_vars().get(name)
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", 
line 421, in get_config_vars
     _init_posix(_CONFIG_VARS)
   File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", 
line 300, in _init_posix
     raise IOError(msg)
IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.3" but "10.5" 
during configure

Though, I do recall seeing this error without having that environment 
set at all.
msg113633 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-08-11 22:09
Looks like reply-by-email stripped some parts of the message.

> does the error occur on the 10.6 machine you used to do the build or another machine?

Another 10.6 machine.
msg113634 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-08-11 22:10
Even simply invoking the interpreter raises this exception!

$ MACOSX_DEPLOYMENT_TARGET=10.3 python2.7
[...] 
IOError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.3" but "10.5" during configure
$
msg114154 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-08-17 20:00
I can reproduce this with a script that builds and installs a couple of python versions, annoyingly enough I don't understand why that code fails.

In particular, in my script the run of python that fails is started with this code:


    lg.debug("Run setup script with '%s'", python)
    pprint.pprint(os.environ)
    p = subprocess.Popen([
        python, "setup.py", "install"],
        cwd=distribute_dir, stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT)


This prints the environment and then runs a setup.py script. What confuses me is that the printed environment does *not* contain MACOSX_DEPLOYMENT_TARGET while that is the only way to trigger this bug.
msg114156 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-08-17 20:06
This (untested) patch should fix the issue:


Index: Lib/sysconfig.py
===================================================================
--- Lib/sysconfig.py	(revision 84147)
+++ Lib/sysconfig.py	(working copy)
@@ -295,9 +295,8 @@
             cur_target = cfg_target
             os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target)
         elif map(int, cfg_target.split('.')) > map(int, cur_target.split('.')):
-            msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" '
-                   'during configure' % (cur_target, cfg_target))
-            raise IOError(msg)
+            os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target)
+            cfg_target = cur_target
 
     # On AIX, there are wrong paths to the linker scripts in the Makefile
     # -- these paths are relative to the Python source, but when installed


This removes the exception, and instead replaces the incompatible environment setting by the configured setting.

It might be better to just have:

Index: Lib/sysconfig.py
===================================================================
--- Lib/sysconfig.py	(revision 84147)
+++ Lib/sysconfig.py	(working copy)
@@ -291,13 +291,8 @@
     if sys.platform == 'darwin' and 'MACOSX_DEPLOYMENT_TARGET' in vars:
         cfg_target = vars['MACOSX_DEPLOYMENT_TARGET']
         cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '')
-        if cur_target == '':
-            cur_target = cfg_target
+        if cur_target != cfg_target:
             os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target)
-        elif map(int, cfg_target.split('.')) > map(int, cur_target.split('.')):
-            msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" '
-                   'during configure' % (cur_target, cfg_target))
-            raise IOError(msg)
 
     # On AIX, there are wrong paths to the linker scripts in the Makefile
     # -- these paths are relative to the Python source, but when installed


This entirely ignores the environment variable and always uses the value that was present during the configure run.
msg114195 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-08-18 04:01
I now understand why my script fails, and it is caused by this issue.

The sysconfig.py code has another major issue: the use of os.putenv. This changes the environment, without changing os.environ. The use of os.putenv should be replaced by setting keys in os.environ to make it easier to discover that changes have been made.

Even that is no good: setting the environment variable should only be done in distutils to ensure that the right build environment is used. It should not be set globally where it will affect code that it was never intended to affect.


BTW. Sridhar: could this be the reason you cannot find the correct reproduction steps for this?  Do you use a build script that is writting in python and run with a copy of python where sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') returns '10.3'?
msg114306 - (view) Author: Sridhar Ratnakumar (srid) Date: 2010-08-18 23:59
On 2010-08-17, at 9:01 PM, Ronald Oussoren wrote:

> I now understand why my script fails, and it is caused by this issue.
> 
> The sysconfig.py code has another major issue: the use of os.putenv. This changes the environment, without changing os.environ. The use of os.putenv should be replaced by setting keys in os.environ to make it easier to discover that changes have been made.
> 
> Even that is no good: setting the environment variable should only be done in distutils to ensure that the right build environment is used. It should not be set globally where it will affect code that it was never intended to affect.

I agree that environment variable should only be affected during distutils build, and not globally.

I now recall debugging this issue (with 2.7 alpha/beta, I guess) and arriving at the same confusion.

> BTW. Sridhar: could this be the reason you cannot find the correct reproduction steps for this?  Do you use a build script that is writting in python and run with a copy of python where sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') returns '10.3'?

Yes, but I am not entirely sure if that copy of python returned 10.3, and I no longer have that copy ... as I've been upgrading 2.6 and 2.7 pretty often in our two Mac build machines.
msg116454 - (view) Author: Stonewall Ballard (stoneyb) Date: 2010-09-15 15:06
I just ran into this with Python 2.7, installed using port. I'm using python to process a text file in an Xcode 3.2 Script build step, and it's throwing the error because my Xcode target has a base sdk of 10.5.
msg116562 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-09-16 15:33
I've attached a patch for 3.2 that should fix the issue. 

The patch adds a couple of testcases (1 for sysconfig and 1 for distutils.command.build_ext), adjust a couple more and implements the following functional changes:

1) sysconfig._init_posix no longer does anything with 
   MACOSX_DEPLOYMENT_TARGET in the environment

2) sysconfig.get_platform always uses MACOSX_DEPLOYMENT_TARGET from 
   the Makefile and ignores the setting from the environment
   (in hindsight looking at the environment was wrong, particularly 
   because that also affects the name of bdist_* files and that can
   confuse tools like distutils)

3) distutils.util.get_platform was changed in the same way and for
   the same reason.

4) distutils.sysconfig._init_posix does still look at 
   MACOSX_DEPLOYMENT_TARGET but changes the environment by updating
   os.environ instead of calling os.putenv. The latter is very 
   confusing when you're debugging environment issues.

I'm not 100% sure about the (lack of) change to distutils.sysconfig._init_posix. It might be better to just always use the deployment target that was specified during the build of python itself.

There is a use-case for overriding the deployment target though: locally build an extension that you use on your machine and that uses compiler/library features that require a newer deployment target than the one used to build python itself.
msg130666 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-03-12 09:54
Another way this issue can show up: when building Python itself. If Parser/Python.asdl needs to be built (as with a new source checkout), the makefile target executes a python script (Parser/asdl_c.py) via /usr/bin/env python (a bootstrap dependency).  If that python happens to be python2.7 and the build MACOSX_DEPLOYMENT_TARGET target is not the same as that as that of the python2.7, the python2.7 fails with the $MACOSX_DEPLOYMENT_TARGET mismatch from sysconfig.py _init_posix and thus the build fails.

The patch looks good to me except that all of the "assertEquals" (now deprecated) should be changed to "assertEqual".  I think parts 1 and 2 should definitely be applied to py3k, 3.2, and 2.7.  I'm less certain about the distutils changes (parts 3 and 4) but I agree they are probably the right thing to do.  Then there's the issue of getting corresponding changes into distutils2 if needed.
msg130810 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-03-14 13:15
Tarek: could you comment on this patch, in particular: is it OK to commit this to 2.7, 3.2 and head?

(I haven't checked yet if the patch still applies cleanly, will do that later today)
msg135018 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-05-03 07:14
This issue is very annoying when you use python's with different deployment targets and should IMHO be fixed in the next release.
msg135046 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-03 16:06
Looks acceptable to me.  A few details in the code could be improved:

+    @unittest.skipUnless(sys.platform == 'darwin', 'MacOSX test')
Skip messages generally use another form, like “test relevant only on Mac OS X”.

+        finally:
+            os.environ = orig_environ
I’ve grown fond of using self.addCleanup(setattr, os, 'environ', os.environ.copy()) instead of try/finally.  The cleanup action can be written right before the monkey-patching line, there’s no need to indent (especially nice when you patch many things, like later in the patch with sys.stdout), and it’s less lines.

+    def _try_compile_deployment_target(self):
+        import textwrap
I’d prefer avoiding function-level imports.

+        fp.close()
I suggest a with statement.

+        tgt = '%02d%01d0'%(tgt)
I think that using real words (“target”) and following PEP 8 (“ % target”) would make this slightly more readable.

+        except CompileError:
+            self.fail("Wrong deployment target during compilation")
Why not just let the CompileError propagate and cause a unittest failure?

+        self.assertEquals(get_platform(), 'macosx-10.4-fat')
assertEquals raises a DeprecationWarning; assertEqual should be used. 
 
+
+
+
+        # Test without MACOSX_DEPLOYMENT_TARGET in the environment
+
Three blank lines, a comment line and another blank line is a lot of whitespace.

+            stderr=open('/dev/null'),
Won’t this cause a ResourceWarning?
msg135403 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-05-07 06:34
I've attached a v2 of the patch which adresses Éric's comments.

I haven't changed the CompileError handling though, that would change a test failure into a test error. IMHO test errors should only happend due to bugs in the test code.

AddCleanup is neat trick, I keep forgetting the nice new features that were added to unittest recently.

The assertEquals issue is one that keeps biting me, I know the correct form is assertEqual but every single time I write tests I keep using assertEquals for some reason.  Maybe its time for some electroshock therapy...
msg135473 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-07 15:33
> I haven't changed the CompileError handling though, that would change
> a test failure into a test error.
Ah, thanks for correcting my mistake.
msg135863 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-05-12 20:39
I trust this patch does the right thing -- can you apply it before the rc this weekend?
msg135908 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-05-13 13:50
I'll apply the patch late tonight (I won't be home until at least 22:30 CEST)
msg135958 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-05-14 06:28
Attached the backport to 2.7 for my v2 patch.
msg136032 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-05-15 15:14
New changeset 9874f213edb2 by Ronald Oussoren in branch '2.7':
Issue #9516: avoid errors in sysconfig when MACOSX_DEPLOYMENT_TARGET is set in shell.
http://hg.python.org/cpython/rev/9874f213edb2

New changeset 5b108229a978 by Ronald Oussoren in branch '3.2':
Issue #9516: avoid errors in sysconfig when MACOSX_DEPLOYMENT_TARGET is set in shell.
http://hg.python.org/cpython/rev/5b108229a978

New changeset 978016199be8 by Ronald Oussoren in branch '2.7':
NEWS entry for fix of issue #9516
http://hg.python.org/cpython/rev/978016199be8

New changeset 25040a6a68e9 by Ronald Oussoren in branch '3.2':
NEWS entry for fix of issue #9516
http://hg.python.org/cpython/rev/25040a6a68e9

New changeset 412d5f2c995f by Ronald Oussoren in branch 'default':
(merge from 3.2) Issue #9516: avoid errors in sysconfig when MACOSX_DEPLOYMENT_TARGET is set in shell.
http://hg.python.org/cpython/rev/412d5f2c995f
msg136033 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-05-15 15:15
I've applied the patches to 3.3, 3.2 and 2.7
msg136256 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-18 17:22
Don’t you get ResourceWarnings from the popens and the unclosed file?
msg137545 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-03 16:14
I ported the patch to packaging.  Please test.
msg138278 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-06-13 21:13
There are several issues here now.

With the patches as now applied, when running the tests with standard OS X installer Pythons, I saw occasional failures of the new test_deployment_target test case ("Unexpected target").   After ensuring that the build_ext tests actually are executed consistently (see the patches for Issue12141), I found that the test case failed consistently when test_distutils was run after test___all__, which is the default.  There was also a telltale warning that test___all__ altered the execution environment.  After investigating, I've come to the conclusion that the root cause of this test failure *and* of the original reported problem in this issue is the original implementation of forcing MACOSX_DEPLOYMENT_TARGET way back in r38123.

The main problem with r38123 is that, while the issue needing fixing is limited to Distutils-spawned build steps, the solution unpredictably can modify the environment of *all* subprocesses (as Ronald noted earlier in msg114195):

>>> import os
>>> os.system('echo $MACOSX_DEPLOYMENT_TARGET')

0
>>> import distutils.command.build
>>> os.system('echo $MACOSX_DEPLOYMENT_TARGET')
10.6
0

The modification occurs in distutils.sysconfig._init_posix when distutils.sysconfig is imported so the env change can be a side-effect of importing other distutils modules, like above.  This behavior has been the case since r38123 but its effects were somewhat masked within the Python interpreter process by the use of os.putenv.  Now that the patches for this issue replaced os.putenv with setting os.environ directly, the changed MACOSX_DEPLOYMENT_TARGET is now visible in the interpreter, too.  And that's the cause of the new test___all__ "altered the execution environment" message.  Running test___all__ causes distutils.sysconfig to be imported which causes the _init_posix one-time initialization to take place which will set MACOSX_DEPLOYMENT_TARGET (if it wasn't already set externally).  Regrtest now sees the change after running test___all__ and restores the original environment thereby deleting MACOSX_DEPLOYMENT_TARGET.  Because _init_posix is only run once, test_distutils fails afterwards because MACOSX_DEPLOYMENT_TARGET is no longer set and will never be set.

So I am now convinced that, indeed, the right solution is to only set MACOSX_DEPLOYMENT_TARGET in the Distutils-spawned processes.  Setting it globally is too fragile and has unintended side-effects (like in the reported problems earlier in this issue).

Beyond that there are some issues with the new test cases.  As it stands, the new test_deployment_target test case tries to run two subtests but the second doesn't actually work: distutils.build_ext doesn't bother recompiling it since the object file leftover from the first subtest appears to be up-to-date.  Also the test cases do not fully test the intended behavior of the deployment target processing:  allowing the deployment target to be overridden to be equal or greater than that of the interpreter build but not less.

Another issue is that with packaging now landed in the default branch (for 3.3), similar code and tests are needed there.  Éric ported the new test cases but distutils.sysconfig does not exist in packaging: it uses the standard sysconfig.  So there is currently no deployment target checking or setting (what's done in distutils.sysconfig._init_posix) at all when using packaging.

The attached patches for 3.3, 3.2, and 2.7 try to address all these issues:
 - The deployment target setting code is removed from
   distutils.sysconfig._init_posix.
 - Distutils.spawn is modified to set the appropriate deployment
   target in the environment of spawned build subprocesses.
 - In test_build_ext, test case test_deployment_target is replaced
   by three new test cases: test_deployment_target_default,
   test_deployment_target_too_low,
   and test_deployment_target_higher_ok.
 - For 3.3 only, similar code is added to spawn in packaging.util
   and the test cases added to test_command_built_ext.
msg138572 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-06-18 08:18
Can the 3.2 part of this be resolved this weekend?
msg138575 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-06-18 09:17
I would like Ronald's take on it (also, I expect to be off-line for the weekend).  Note, as it stands now, 3.2.1 (without any further patches) would have the same less than ideal behavior as 2.7.2.
msg138580 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2011-06-18 10:26
I agree with Ned, the changes to the environment should only be done in subprocesses started by distutils.

The patch looks fine, but I haven't tested the patches yet.
msg139390 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-06-29 03:24
New changeset 29c670f0d7d5 by Ned Deily in branch '2.7':
Issue #9516: Correct and expand OS X deployment target tests in distutils
http://hg.python.org/cpython/rev/29c670f0d7d5

New changeset 01434498e55e by Ned Deily in branch '2.7':
Issue #9516: Change distutils to no longer globally attempt to check and
http://hg.python.org/cpython/rev/01434498e55e

New changeset e9e1fb4e3752 by Ned Deily in branch '2.7':
Issue #9516: Update Misc/NEWS.
http://hg.python.org/cpython/rev/e9e1fb4e3752

New changeset bb89023191a0 by Ned Deily in branch '3.2':
Issue #9516: Correct and expand OS X deployment target tests in distutils
http://hg.python.org/cpython/rev/bb89023191a0

New changeset b95eee310931 by Ned Deily in branch '3.2':
Issue #9516: Change distutils to no longer globally attempt to check and
http://hg.python.org/cpython/rev/b95eee310931

New changeset 8e0cfba9c8c4 by Ned Deily in branch '3.2':
Issue #9516: Update Misc/NEWS.
http://hg.python.org/cpython/rev/8e0cfba9c8c4

New changeset 371a818687a5 by Ned Deily in branch 'default':
Issue #9516: Merge Distutils changes from 3.2
http://hg.python.org/cpython/rev/371a818687a5

New changeset 47b670d386cd by Ned Deily in branch 'default':
Issue #9516: Port OS X deployment target tests from distutils to packaging
http://hg.python.org/cpython/rev/47b670d386cd

New changeset c1ae16fce76d by Ned Deily in branch 'default':
Issue #9516: Port the revised deployment target processing for OSX from
http://hg.python.org/cpython/rev/c1ae16fce76d

New changeset 1bd45742751b by Ned Deily in branch 'default':
Issue #9516: Update Misc/NEWS to include packaging.
http://hg.python.org/cpython/rev/1bd45742751b
msg139391 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-06-29 03:40
While I am a little concerned about applying these fixes, it is clear that the previous behavior was broken and the initial set of patches as applied did not improve matters. The only risk I can see is that there is a slight chance that there *might* be some 3rd-party package that unknowingly depended on the previous behavior of setting MACOSX_DEPLOYMENT_TARGET globally and which might now fail.  There is no simple way to find such packages short of attempting to build them and test them.  However, if there *should* be such packages, the simple fix for them is to export the desired MACOSX_DEPLOYMENT_TARGET value into the interpreter process (via a shell variable, for instance).  So, I think it best to bite the bullet.  I've applied the Distutils patches to 2.7 (for 2.7.3), to 3.2 (for 3.2.1), to default (for 3.3) and the packaging patches to default (for 3.3).
History
Date User Action Args
2022-04-11 14:57:04adminsetgithub: 53725
2011-11-06 00:34:25floxsetnosy: + flox
2011-06-29 23:55:27ned.deilysetstatus: pending -> closed
2011-06-29 03:40:50ned.deilysetstatus: open -> pending
versions: + Python 2.7, Python 3.2
messages: + msg139391

resolution: fixed
stage: patch review -> resolved
2011-06-29 03:24:48python-devsetmessages: + msg139390
2011-06-18 10:26:47ronaldoussorensetmessages: + msg138580
2011-06-18 09:17:15ned.deilysetmessages: + msg138575
2011-06-18 08:18:33georg.brandlsetmessages: + msg138572
2011-06-13 21:16:30ned.deilysetfiles: + issue9516_v3_packaging.patch
2011-06-13 21:15:58ned.deilysetfiles: + issue9516_v3_test_packaging.patch
2011-06-13 21:15:25ned.deilysetfiles: + issue9516_v3_distutils_27.patch
2011-06-13 21:14:54ned.deilysetfiles: + issue9516_v3_test_distutils_27.patch
2011-06-13 21:14:12ned.deilysetfiles: + issue9516_v3_distutils.patch
2011-06-13 21:13:44ned.deilysetfiles: + issue9516_v3_test_distutils.patch
resolution: fixed -> (no value)
messages: + msg138278

stage: resolved -> patch review
2011-06-03 16:14:29eric.araujosetstatus: closed -> open
files: + darwin-target-sysconfig-p7g.diff

components: + Distutils2
versions: - Python 2.7, Python 3.2
nosy: + alexis

messages: + msg137545
2011-05-18 17:22:33eric.araujosetmessages: + msg136256
2011-05-15 15:15:26ronaldoussorensetstatus: open -> closed
resolution: fixed
messages: + msg136033

stage: commit review -> resolved
2011-05-15 15:14:11python-devsetnosy: + python-dev
messages: + msg136032
2011-05-14 06:28:26ronaldoussorensetfiles: + issue9516-v2-python2.7.patch

messages: + msg135958
2011-05-14 05:52:26ronaldoussorensetversions: - Python 3.1
2011-05-13 13:50:12ronaldoussorensetmessages: + msg135908
2011-05-12 20:39:18georg.brandlsetmessages: + msg135863
2011-05-07 15:33:29eric.araujosetmessages: + msg135473
2011-05-07 06:34:25ronaldoussorensetfiles: + issue9516-v2.patch

messages: + msg135403
2011-05-03 16:06:41eric.araujosetmessages: + msg135046
versions: + Python 3.1
2011-05-03 07:14:48ronaldoussorensetpriority: normal -> release blocker
nosy: + benjamin.peterson, georg.brandl
messages: + msg135018

2011-04-09 15:58:11ned.deilylinkissue11808 superseder
2011-03-19 02:36:21eric.araujosetnosy: + eric.araujo

title: sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.3" but "10.5" during configure -> sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.3" but "10.5" during configure
2011-03-14 13:15:01ronaldoussorensetnosy: ronaldoussoren, tarek, ned.deily, srid, stoneyb, kontinuity
messages: + msg130810
2011-03-12 09:54:27ned.deilysetversions: + Python 3.3
nosy: + ned.deily

messages: + msg130666

stage: needs patch -> commit review
2011-01-26 18:29:27kontinuitysetnosy: + kontinuity
2010-09-16 15:33:43ronaldoussorensetfiles: + issue9516.patch
keywords: + patch
messages: + msg116562
2010-09-15 15:06:01stoneybsetnosy: + stoneyb
messages: + msg116454
2010-08-18 23:59:44sridsetmessages: + msg114306
2010-08-18 04:01:18ronaldoussorensetmessages: + msg114195
2010-08-17 20:06:40ronaldoussorensetmessages: + msg114156
2010-08-17 20:00:42ronaldoussorensetmessages: + msg114154
2010-08-11 22:10:46sridsetmessages: + msg113634
2010-08-11 22:09:29sridsetmessages: + msg113633
2010-08-11 22:08:05sridsetmessages: + msg113632
title: sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.3" but "10.5" during configure -> sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.3" but "10.5" during configure
2010-08-11 15:40:26ronaldoussorensetassignee: tarek -> ronaldoussoren
messages: + msg113606
2010-08-10 11:45:20r.david.murraysetversions: - Python 3.3
2010-08-09 21:10:13sridsetmessages: + msg113474
2010-08-07 10:10:13ronaldoussorensettype: behavior
messages: + msg113161
stage: needs patch
2010-08-06 19:55:12r.david.murraysetnosy: + ronaldoussoren
2010-08-04 21:00:25sridsetcomponents: + macOS
versions: + Python 3.3
2010-08-04 20:59:49sridcreate