Skip to content

Commit 8703178

Browse files
authored
bpo-43568: Drop support for MACOSX_DEPLOYMENT_TARGET < 10.3 (GH-25827)
Only complain if the config target is >= 10.3 and the current target is < 10.3. The check was originally added to ensure that incompatible LDSHARED flags are not used, because -undefined dynamic_lookup is used when building for 10.3 and later, and is not supported on older OS versions. Apart from that, there should be no problem in general with using an older target. Authored-by: Joshua Root <[email protected]>
1 parent 33ec88a commit 8703178

File tree

6 files changed

+15
-34
lines changed

6 files changed

+15
-34
lines changed

Lib/_osx_support.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,10 @@ def get_platform_osx(_config_vars, osname, release, machine):
525525
try:
526526
macrelease = tuple(int(i) for i in macrelease.split('.')[0:2])
527527
except ValueError:
528-
macrelease = (10, 0)
528+
macrelease = (10, 3)
529529
else:
530530
# assume no universal support
531-
macrelease = (10, 0)
531+
macrelease = (10, 3)
532532

533533
if (macrelease >= (10, 4)) and '-arch' in cflags.strip():
534534
# The universal build will build fat binaries, but not on

Lib/distutils/spawn.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,17 @@ def spawn(cmd, search_path=1, verbose=0, dry_run=0):
5959
if _cfg_target:
6060
_cfg_target_split = [int(x) for x in _cfg_target.split('.')]
6161
if _cfg_target:
62-
# ensure that the deployment target of build process is not less
63-
# than that used when the interpreter was built. This ensures
64-
# extension modules are built with correct compatibility values
62+
# Ensure that the deployment target of the build process is not
63+
# less than 10.3 if the interpreter was built for 10.3 or later.
64+
# This ensures extension modules are built with correct
65+
# compatibility values, specifically LDSHARED which can use
66+
# '-undefined dynamic_lookup' which only works on >= 10.3.
6567
cur_target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', _cfg_target)
66-
if _cfg_target_split > [int(x) for x in cur_target.split('.')]:
68+
cur_target_split = [int(x) for x in cur_target.split('.')]
69+
if _cfg_target_split[:2] >= [10, 3] and cur_target_split[:2] < [10, 3]:
6770
my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: '
68-
'now "%s" but "%s" during configure'
71+
'now "%s" but "%s" during configure;'
72+
'must use 10.3 or later'
6973
% (cur_target, _cfg_target))
7074
raise DistutilsPlatformError(my_msg)
7175
env = dict(os.environ,

Lib/test/test_posix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ def test_getgroups(self):
10701070
# Issues 16698: OS X ABIs prior to 10.6 have limits on getgroups()
10711071
if sys.platform == 'darwin':
10721072
import sysconfig
1073-
dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.0'
1073+
dt = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') or '10.3'
10741074
if tuple(int(n) for n in dt.split('.')[0:2]) < (10, 6):
10751075
raise unittest.SkipTest("getgroups(2) is broken prior to 10.6")
10761076

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Drop support for MACOSX_DEPLOYMENT_TARGET < 10.3

configure

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9656,19 +9656,7 @@ then
96569656
test ${dep_target_minor} -le 2
96579657
then
96589658
# building for OS X 10.0 through 10.2
9659-
LDSHARED='$(CC) -bundle'
9660-
LDCXXSHARED='$(CXX) -bundle'
9661-
if test "$enable_framework" ; then
9662-
# Link against the framework. All externals should be defined.
9663-
BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
9664-
LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
9665-
LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
9666-
else
9667-
# No framework, use the Python app as bundle-loader
9668-
BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
9669-
LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
9670-
LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
9671-
fi
9659+
as_fn_error $? "MACOSX_DEPLOYMENT_TARGET too old ($MACOSX_DEPLOYMENT_TARGET), only 10.3 or later is supported" "$LINENO" 5
96729660
else
96739661
# building for OS X 10.3 and later
96749662
LDSHARED='$(CC) -bundle -undefined dynamic_lookup'

configure.ac

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,19 +2651,7 @@ then
26512651
test ${dep_target_minor} -le 2
26522652
then
26532653
# building for OS X 10.0 through 10.2
2654-
LDSHARED='$(CC) -bundle'
2655-
LDCXXSHARED='$(CXX) -bundle'
2656-
if test "$enable_framework" ; then
2657-
# Link against the framework. All externals should be defined.
2658-
BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2659-
LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2660-
LDCXXSHARED="$LDCXXSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
2661-
else
2662-
# No framework, use the Python app as bundle-loader
2663-
BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
2664-
LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
2665-
LDCXXSHARED="$LDCXXSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
2666-
fi
2654+
AC_MSG_ERROR([MACOSX_DEPLOYMENT_TARGET too old ($MACOSX_DEPLOYMENT_TARGET), only 10.3 or later is supported])
26672655
else
26682656
# building for OS X 10.3 and later
26692657
LDSHARED='$(CC) -bundle -undefined dynamic_lookup'

0 commit comments

Comments
 (0)