|
1 | 1 | diff --git a/setup.py b/setup.py
|
2 |
| -index 15d81e4..5893d3d 100755 |
| 2 | +index cbc2641..1a0abb3 100755 |
3 | 3 | --- a/setup.py
|
4 | 4 | +++ b/setup.py
|
5 |
| -@@ -15,6 +15,7 @@ import re |
6 |
| - import struct |
7 |
| - import subprocess |
8 |
| - import sys |
9 |
| -+import sysconfig |
10 |
| - import warnings |
11 |
| - from distutils import ccompiler, sysconfig |
12 |
| - from distutils.command.build_ext import build_ext |
13 |
| -@@ -311,6 +312,11 @@ class pil_build_ext(build_ext): |
14 |
| - # darwin ports installation directories |
15 |
| - _add_directory(library_dirs, "/opt/local/lib") |
16 |
| - _add_directory(include_dirs, "/opt/local/include") |
17 |
| -+ # Check variable introduced in #27631. |
18 |
| -+ sysroot = sysconfig.get_config_var('Py_MACOS_SYSROOT') |
19 |
| -+ if sysroot is not None: |
20 |
| -+ _add_directory(library_dirs, sysroot+"/usr/lib") |
21 |
| -+ _add_directory(include_dirs, sysroot+"/usr/include") |
| 5 | +@@ -480,14 +480,16 @@ class pil_build_ext(build_ext): |
| 6 | + _add_directory(include_dirs, "/usr/X11/include") |
22 | 7 |
|
23 |
| - # if Homebrew is installed, use its lib and include directories |
24 |
| - try: |
| 8 | + # SDK install path |
| 9 | +- try: |
| 10 | +- sdk_path = ( |
| 11 | +- subprocess.check_output(["xcrun", "--show-sdk-path"]) |
| 12 | +- .strip() |
| 13 | +- .decode("latin1") |
| 14 | +- ) |
| 15 | +- except Exception: |
| 16 | +- sdk_path = None |
| 17 | ++ sdk_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" |
| 18 | ++ if not os.path.exists(sdk_path): |
| 19 | ++ try: |
| 20 | ++ sdk_path = ( |
| 21 | ++ subprocess.check_output(["xcrun", "--show-sdk-path"]) |
| 22 | ++ .strip() |
| 23 | ++ .decode("latin1") |
| 24 | ++ ) |
| 25 | ++ except Exception: |
| 26 | ++ sdk_path = None |
| 27 | + if sdk_path: |
| 28 | + _add_directory(library_dirs, os.path.join(sdk_path, "usr", "lib")) |
| 29 | + _add_directory(include_dirs, os.path.join(sdk_path, "usr", "include")) |
0 commit comments