Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from h-vetinari/sdk
pick upstream patch to fix macos sdk detection
- Loading branch information
Showing
4 changed files
with
94 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
recipe/patches/0003-Moved-macOS-SDK-logic-into-a-separate-method.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
From d9afb11be92a317de829f82aa175d3cdc572ec8e Mon Sep 17 00:00:00 2001 | ||
From: Andrew Murray <radarhere@users.noreply.github.com> | ||
Date: Thu, 11 Nov 2021 20:51:13 +1100 | ||
Subject: [PATCH 3/3] Moved macOS SDK logic into a separate method | ||
|
||
--- | ||
setup.py | 41 ++++++++++++++++++++++------------------- | ||
1 file changed, 22 insertions(+), 19 deletions(-) | ||
|
||
diff --git a/setup.py b/setup.py | ||
index 341cb331..7655c209 100755 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -405,6 +405,27 @@ class pil_build_ext(build_ext): | ||
self.extensions.remove(extension) | ||
break | ||
|
||
+ def get_macos_sdk_path(self): | ||
+ try: | ||
+ sdk_path = ( | ||
+ subprocess.check_output(["xcrun", "--show-sdk-path"]) | ||
+ .strip() | ||
+ .decode("latin1") | ||
+ ) | ||
+ except Exception: | ||
+ sdk_path = None | ||
+ if ( | ||
+ not sdk_path | ||
+ or sdk_path == "/Applications/Xcode.app/Contents/Developer" | ||
+ "/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" | ||
+ ): | ||
+ commandlinetools_sdk_path = ( | ||
+ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" | ||
+ ) | ||
+ if os.path.exists(commandlinetools_sdk_path): | ||
+ sdk_path = commandlinetools_sdk_path | ||
+ return sdk_path | ||
+ | ||
def build_extensions(self): | ||
|
||
library_dirs = [] | ||
@@ -532,25 +553,7 @@ class pil_build_ext(build_ext): | ||
_add_directory(library_dirs, "/usr/X11/lib") | ||
_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 | ||
- if ( | ||
- not sdk_path | ||
- or sdk_path == "/Applications/Xcode.app/Contents/Developer" | ||
- "/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" | ||
- ): | ||
- commandlinetools_sdk_path = ( | ||
- "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" | ||
- ) | ||
- if os.path.exists(commandlinetools_sdk_path): | ||
- sdk_path = commandlinetools_sdk_path | ||
+ sdk_path = self.get_macos_sdk_path() | ||
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")) | ||
-- | ||
2.32.0.windows.2 | ||
|