Skip to content

Commit 0e3eb70

Browse files
authored
Merge pull request #1 from radarhere/homebrew-isolation
Disable platform guessing instead of adding dependencies-prefix
2 parents 9dc6904 + 378df7a commit 0e3eb70

File tree

2 files changed

+40
-53
lines changed

2 files changed

+40
-53
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ before-all = ".github/workflows/wheels-dependencies.sh"
9595
build-verbosity = 1
9696

9797
config-settings = "raqm=enable raqm=vendor fribidi=vendor imagequant=disable"
98-
# Add an explicit dependencies prefix for macOS.
99-
macos.config-settings = "raqm=enable raqm=vendor fribidi=vendor imagequant=disable dependencies-prefix=./build/deps/darwin"
98+
# Disable platform guessing on macOS
99+
macos.config-settings = "raqm=enable raqm=vendor fribidi=vendor imagequant=disable platform-guessing=disable"
100100

101101
test-command = "cd {project} && .github/workflows/wheels-test.sh"
102102
test-extras = "tests"

setup.py

Lines changed: 38 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,6 @@ def __iter__(self) -> Iterator[str]:
344344
for x in ("raqm", "fribidi")
345345
]
346346
+ [
347-
(
348-
"dependencies-prefix",
349-
None,
350-
"The prefix where build dependencies are located.",
351-
),
352347
("disable-platform-guessing", None, "Disable platform guessing on Linux"),
353348
("debug", None, "Debug logging"),
354349
]
@@ -360,7 +355,6 @@ def check_configuration(option: str, value: str) -> bool | None:
360355
return True if value in configuration.get(option, []) else None
361356

362357
def initialize_options(self) -> None:
363-
self.dependencies_prefix = configuration.get("dependencies-prefix", [])
364358
self.disable_platform_guessing = self.check_configuration(
365359
"platform-guessing", "disable"
366360
)
@@ -570,54 +564,47 @@ def build_extensions(self) -> None:
570564
)
571565

572566
elif sys.platform == "darwin":
573-
if self.dependencies_prefix:
574-
# Use the explicitly provided prefixes for dependencies.
575-
for prefix in self.dependencies_prefix:
576-
_add_directory(library_dirs, os.path.join(prefix, "lib"))
577-
_add_directory(include_dirs, os.path.join(prefix, "include"))
578-
else:
579-
# Guess the dependency locations based on homebrew/fink/macports
580-
# attempt to make sure we pick freetype2 over other versions
581-
_add_directory(include_dirs, "/sw/include/freetype2")
582-
_add_directory(include_dirs, "/sw/lib/freetype2/include")
583-
# fink installation directories
584-
_add_directory(library_dirs, "/sw/lib")
585-
_add_directory(include_dirs, "/sw/include")
586-
# darwin ports installation directories
587-
_add_directory(library_dirs, "/opt/local/lib")
588-
_add_directory(include_dirs, "/opt/local/include")
589-
590-
# if Homebrew is installed, use its lib and include directories
591-
try:
592-
prefix = (
593-
subprocess.check_output(["brew", "--prefix"])
594-
.strip()
595-
.decode("latin1")
596-
)
597-
except Exception:
598-
# Homebrew not installed
599-
prefix = None
567+
# attempt to make sure we pick freetype2 over other versions
568+
_add_directory(include_dirs, "/sw/include/freetype2")
569+
_add_directory(include_dirs, "/sw/lib/freetype2/include")
570+
# fink installation directories
571+
_add_directory(library_dirs, "/sw/lib")
572+
_add_directory(include_dirs, "/sw/include")
573+
# darwin ports installation directories
574+
_add_directory(library_dirs, "/opt/local/lib")
575+
_add_directory(include_dirs, "/opt/local/include")
600576

601-
ft_prefix = None
577+
# if Homebrew is installed, use its lib and include directories
578+
try:
579+
prefix = (
580+
subprocess.check_output(["brew", "--prefix"])
581+
.strip()
582+
.decode("latin1")
583+
)
584+
except Exception:
585+
# Homebrew not installed
586+
prefix = None
602587

603-
if prefix:
604-
# add Homebrew's include and lib directories
605-
_add_directory(library_dirs, os.path.join(prefix, "lib"))
606-
_add_directory(include_dirs, os.path.join(prefix, "include"))
607-
_add_directory(
608-
include_dirs, os.path.join(prefix, "opt", "zlib", "include")
609-
)
610-
ft_prefix = os.path.join(prefix, "opt", "freetype")
588+
ft_prefix = None
611589

612-
if ft_prefix and os.path.isdir(ft_prefix):
613-
# freetype might not be linked into Homebrew's prefix
614-
_add_directory(library_dirs, os.path.join(ft_prefix, "lib"))
615-
_add_directory(include_dirs, os.path.join(ft_prefix, "include"))
616-
else:
617-
# fall back to freetype from XQuartz if
618-
# Homebrew's freetype is missing
619-
_add_directory(library_dirs, "/usr/X11/lib")
620-
_add_directory(include_dirs, "/usr/X11/include")
590+
if prefix:
591+
# add Homebrew's include and lib directories
592+
_add_directory(library_dirs, os.path.join(prefix, "lib"))
593+
_add_directory(include_dirs, os.path.join(prefix, "include"))
594+
_add_directory(
595+
include_dirs, os.path.join(prefix, "opt", "zlib", "include")
596+
)
597+
ft_prefix = os.path.join(prefix, "opt", "freetype")
598+
599+
if ft_prefix and os.path.isdir(ft_prefix):
600+
# freetype might not be linked into Homebrew's prefix
601+
_add_directory(library_dirs, os.path.join(ft_prefix, "lib"))
602+
_add_directory(include_dirs, os.path.join(ft_prefix, "include"))
603+
else:
604+
# fall back to freetype from XQuartz if
605+
# Homebrew's freetype is missing
606+
_add_directory(library_dirs, "/usr/X11/lib")
607+
_add_directory(include_dirs, "/usr/X11/include")
621608

622609
# Add the macOS SDK path.
623610
sdk_path = self.get_macos_sdk_path()

0 commit comments

Comments
 (0)