diff options
author | Ned Deily <nad@python.org> | 2019-07-01 23:15:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 23:15:09 (GMT) |
commit | da7f6dbbf52fe7074360a9eae918806da60139c5 (patch) | |
tree | 9a5fa9d8ad61738ab030ee820974bfb92937aca6 | |
parent | bc60c47169d1cb33f6fbe1ed64c09a536e82e1c3 (diff) | |
download | cpython-da7f6dbbf52fe7074360a9eae918806da60139c5.zip cpython-da7f6dbbf52fe7074360a9eae918806da60139c5.tar.gz cpython-da7f6dbbf52fe7074360a9eae918806da60139c5.tar.bz2 |
bpo-19960: Fix building of zlib on macOS without installed headers (GH-14257)
When building 2.7 on macOS without system header files installed in
``/usr/include``, a few extension modules dependent on system-supplied
third-party libraries were not being built, most notably zlib.
This situation arose in the past when building without the Command
Line Tools and the option to install header files in the traditional
system locations (like /usr/include). As of macOS 10.14, the
header files are only available in an SDK so the problem addressed
here affects most 2.7 builds.
-rw-r--r-- | Misc/NEWS.d/next/macOS/2019-06-20-01-16-16.bpo-19960.LpLUPF.rst | 4 | ||||
-rw-r--r-- | setup.py | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/macOS/2019-06-20-01-16-16.bpo-19960.LpLUPF.rst b/Misc/NEWS.d/next/macOS/2019-06-20-01-16-16.bpo-19960.LpLUPF.rst new file mode 100644 index 0000000..b15c6d6 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2019-06-20-01-16-16.bpo-19960.LpLUPF.rst @@ -0,0 +1,4 @@ +When building 2.7 on macOS without system header files installed in +``/usr/include``, a few extension modules dependent on system-supplied +third-party libraries were not being built, most notably zlib. + @@ -39,8 +39,15 @@ def add_dir_to_list(dirlist, dir): """Add the directory 'dir' to the list 'dirlist' (at the front) if 1) 'dir' is not already in 'dirlist' 2) 'dir' actually exists, and is a directory.""" - if dir is not None and os.path.isdir(dir) and dir not in dirlist: - dirlist.insert(0, dir) + if dir is not None and dir not in dirlist: + if host_platform == 'darwin' and is_macosx_sdk_path(dir): + # If in a macOS SDK path, check relative to the SDK root + dir_exists = os.path.isdir( + os.path.join(macosx_sdk_root(), dir[1:])) + else: + dir_exists = os.path.isdir(dir) + if dir_exists: + dirlist.insert(0, dir) MACOS_SDK_ROOT = None |