Skip to content

Commit f601dc9

Browse files
committed
Skip sys.prefix dirs when cross-compiling
Update Pillow setup patch to avoid unconditionally adding sys.prefix lib/include directories when cross-compiling. The change wraps the _add_directory calls for sys.prefix in a check against self.disable_platform_guessing so host headers/libs won't be pulled in during cross-compilation. Also includes minor whitespace/formatting cleanup around initialize_options.
1 parent 63e3f5b commit f601dc9

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

recipes/pillow/patches/setup-11.x.patch

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ index a85731d..fbbb5b6 100644
44
+++ b/setup.py
55
@@ -355,9 +355,7 @@ class pil_build_ext(build_ext):
66
return True if value in configuration.get(option, []) else None
7-
7+
88
def initialize_options(self) -> None:
99
- self.disable_platform_guessing = self.check_configuration(
1010
- "platform-guessing", "disable"
@@ -13,3 +13,16 @@ index a85731d..fbbb5b6 100644
1313
self.add_imaging_libs = ""
1414
build_ext.initialize_options(self)
1515
for x in self.feature:
16+
@@ -548,8 +546,10 @@ class pil_build_ext(build_ext):
17+
for d in os.environ[k].split(os.path.pathsep):
18+
_add_directory(library_dirs, d)
19+
20+
- _add_directory(library_dirs, os.path.join(sys.prefix, "lib"))
21+
- _add_directory(include_dirs, os.path.join(sys.prefix, "include"))
22+
+ # Skip adding sys.prefix paths when cross-compiling to avoid host headers
23+
+ if not self.disable_platform_guessing:
24+
+ _add_directory(library_dirs, os.path.join(sys.prefix, "lib"))
25+
+ _add_directory(include_dirs, os.path.join(sys.prefix, "include"))
26+
27+
#
28+
# add platform directories

0 commit comments

Comments
 (0)