From e7270eb5a1dfa99b54dcb74d870aab0a1fe73d56 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 21 Jul 2021 22:45:35 +1000 Subject: [PATCH] Prefer command line tools SDK on macOS --- setup.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 6dc4e1b77..b56e90634 100755 --- a/setup.py +++ b/setup.py @@ -533,14 +533,16 @@ class pil_build_ext(build_ext): _add_directory(include_dirs, "/usr/X11/include") # SDK install path - try: - sdk_path = ( - subprocess.check_output(["xcrun", "--show-sdk-path"]) - .strip() - .decode("latin1") - ) - except Exception: - sdk_path = None + sdk_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" + if not os.path.exists(sdk_path): + try: + sdk_path = ( + subprocess.check_output(["xcrun", "--show-sdk-path"]) + .strip() + .decode("latin1") + ) + except Exception: + sdk_path = None if sdk_path: _add_directory(library_dirs, os.path.join(sdk_path, "usr", "lib")) _add_directory(include_dirs, os.path.join(sdk_path, "usr", "include"))