summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2020-11-22 05:14:25 (GMT)
committerGitHub <noreply@github.com>2020-11-22 05:14:25 (GMT)
commit404a719b5127602c1a948f8e189ab61cd3f147d8 (patch)
tree3c5c46adc53527468927ef6e5cdb43e84a6d6432 /setup.py
parent453bc1da2023d6cbe362637a2e0b06d0521f013c (diff)
downloadcpython-404a719b5127602c1a948f8e189ab61cd3f147d8.zip
cpython-404a719b5127602c1a948f8e189ab61cd3f147d8.tar.gz
cpython-404a719b5127602c1a948f8e189ab61cd3f147d8.tar.bz2
bpo-41116: Ensure system supplied libraries are found on macOS 11 (GH-23301)
On macOS system provided libraries are in a shared library cache and not at their usual location. This PR teaches distutils to search in the SDK, even if there was no "-sysroot" argument in the compiler flags.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py31
1 files changed, 4 insertions, 27 deletions
diff --git a/setup.py b/setup.py
index 6546544..398d925 100644
--- a/setup.py
+++ b/setup.py
@@ -9,6 +9,7 @@ import re
import sys
import sysconfig
from glob import glob, escape
+import _osx_support
try:
@@ -176,34 +177,10 @@ def macosx_sdk_root():
m = re.search(r'-isysroot\s*(\S+)', cflags)
if m is not None:
MACOS_SDK_ROOT = m.group(1)
- MACOS_SDK_SPECIFIED = MACOS_SDK_ROOT != '/'
else:
- MACOS_SDK_ROOT = '/'
- MACOS_SDK_SPECIFIED = False
- cc = sysconfig.get_config_var('CC')
- tmpfile = '/tmp/setup_sdk_root.%d' % os.getpid()
- try:
- os.unlink(tmpfile)
- except:
- pass
- ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (cc, tmpfile))
- in_incdirs = False
- try:
- if ret == 0:
- with open(tmpfile) as fp:
- for line in fp.readlines():
- if line.startswith("#include <...>"):
- in_incdirs = True
- elif line.startswith("End of search list"):
- in_incdirs = False
- elif in_incdirs:
- line = line.strip()
- if line == '/usr/include':
- MACOS_SDK_ROOT = '/'
- elif line.endswith(".sdk/usr/include"):
- MACOS_SDK_ROOT = line[:-12]
- finally:
- os.unlink(tmpfile)
+ MACOS_SDK_ROOT = _osx_support._default_sysroot(
+ sysconfig.get_config_var('CC'))
+ MACOS_SDK_SPECIFIED = MACOS_SDK_ROOT != '/'
return MACOS_SDK_ROOT