Skip to content

Isolate macOS wheel builds from Homebrew #8497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0fe55d6
Isolate macOS build from Homebrew.
freakboy3742 Oct 25, 2024
fc35fcc
Cleanups and typos identified by code review.
freakboy3742 Oct 25, 2024
00809a2
Tweaks to ensure isolation from Homebrew on x86_64.
freakboy3742 Oct 25, 2024
06dbfed
Bump the multibuild version to fix jpeg-turbo issue.
freakboy3742 Oct 25, 2024
5a8373e
Correct a dumb pip invocation error.
freakboy3742 Oct 25, 2024
140a06e
Explicitly disable libdeflate on libtiff.
freakboy3742 Oct 25, 2024
0961d3d
Possible fix for linux build failures.
freakboy3742 Oct 25, 2024
43c34fc
Copy manylinux lib64 files from the correct built prefix.
freakboy3742 Oct 25, 2024
3e4be4b
Merge branch 'main' into homebrew-isolation
radarhere Oct 28, 2024
0855468
Revert fribidi/raqm changes for macOS builds.
freakboy3742 Oct 28, 2024
8308bf3
Bump multibuild to include more cmake changes.
freakboy3742 Oct 28, 2024
c74a5bd
Correct paths used for Linux build.
freakboy3742 Oct 29, 2024
72d81e2
Simplify Linux config by correcting a logic error in macOS config.
freakboy3742 Oct 29, 2024
ec214e4
Can't check IS_MACOS until common_utils is invoked.
freakboy3742 Oct 29, 2024
d1a4f80
Don't use multibuild variables before invoking multibuild.
freakboy3742 Oct 29, 2024
6d13704
Remove stray debug.
freakboy3742 Oct 29, 2024
467f120
Merge branch 'main' into homebrew-isolation
radarhere Oct 29, 2024
c6912f8
Corrected typo in code comment.
freakboy3742 Oct 29, 2024
96ae15c
Merge branch 'main' into homebrew-isolation
freakboy3742 Oct 29, 2024
01270b5
Use the intended entry point for the x86_64 brew binary.
freakboy3742 Oct 30, 2024
51e3623
Revert x86_64 homebrew location change (with explanation).
freakboy3742 Oct 31, 2024
e82b539
Correct handling of vendored fribidi.
freakboy3742 Nov 6, 2024
904416b
Merge branch 'main' into homebrew-isolation
freakboy3742 Nov 6, 2024
4e35852
Correct typo in comment.
freakboy3742 Nov 7, 2024
681a03b
Apply suggestions from code review
freakboy3742 Nov 9, 2024
378df7a
Disable platform guessing instead of adding dependencies-prefix
radarhere Nov 12, 2024
9dc6904
Correct the lookup of libfribidi on x86 macOS installs.
freakboy3742 Nov 13, 2024
0e3eb70
Merge pull request #1 from radarhere/homebrew-isolation
freakboy3742 Nov 13, 2024
54f2334
More tweaks from code review.
freakboy3742 Nov 16, 2024
96b898c
A couple more cleanups from code review.
freakboy3742 Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ before-all = ".github/workflows/wheels-dependencies.sh"
build-verbosity = 1

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

test-command = "cd {project} && .github/workflows/wheels-test.sh"
test-extras = "tests"
Expand Down
89 changes: 38 additions & 51 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,6 @@ def __iter__(self) -> Iterator[str]:
for x in ("raqm", "fribidi")
]
+ [
(
"dependencies-prefix",
None,
"The prefix where build dependencies are located.",
),
("disable-platform-guessing", None, "Disable platform guessing on Linux"),
("debug", None, "Debug logging"),
]
Expand All @@ -360,7 +355,6 @@ def check_configuration(option: str, value: str) -> bool | None:
return True if value in configuration.get(option, []) else None

def initialize_options(self) -> None:
self.dependencies_prefix = configuration.get("dependencies-prefix", [])
self.disable_platform_guessing = self.check_configuration(
"platform-guessing", "disable"
)
Expand Down Expand Up @@ -570,54 +564,47 @@ def build_extensions(self) -> None:
)

elif sys.platform == "darwin":
if self.dependencies_prefix:
# Use the explicitly provided prefixes for dependencies.
for prefix in self.dependencies_prefix:
_add_directory(library_dirs, os.path.join(prefix, "lib"))
_add_directory(include_dirs, os.path.join(prefix, "include"))
else:
# Guess the dependency locations based on homebrew/fink/macports
# attempt to make sure we pick freetype2 over other versions
_add_directory(include_dirs, "/sw/include/freetype2")
_add_directory(include_dirs, "/sw/lib/freetype2/include")
# fink installation directories
_add_directory(library_dirs, "/sw/lib")
_add_directory(include_dirs, "/sw/include")
# darwin ports installation directories
_add_directory(library_dirs, "/opt/local/lib")
_add_directory(include_dirs, "/opt/local/include")

# if Homebrew is installed, use its lib and include directories
try:
prefix = (
subprocess.check_output(["brew", "--prefix"])
.strip()
.decode("latin1")
)
except Exception:
# Homebrew not installed
prefix = None
# attempt to make sure we pick freetype2 over other versions
_add_directory(include_dirs, "/sw/include/freetype2")
_add_directory(include_dirs, "/sw/lib/freetype2/include")
# fink installation directories
_add_directory(library_dirs, "/sw/lib")
_add_directory(include_dirs, "/sw/include")
# darwin ports installation directories
_add_directory(library_dirs, "/opt/local/lib")
_add_directory(include_dirs, "/opt/local/include")

ft_prefix = None
# if Homebrew is installed, use its lib and include directories
try:
prefix = (
subprocess.check_output(["brew", "--prefix"])
.strip()
.decode("latin1")
)
except Exception:
# Homebrew not installed
prefix = None

if prefix:
# add Homebrew's include and lib directories
_add_directory(library_dirs, os.path.join(prefix, "lib"))
_add_directory(include_dirs, os.path.join(prefix, "include"))
_add_directory(
include_dirs, os.path.join(prefix, "opt", "zlib", "include")
)
ft_prefix = os.path.join(prefix, "opt", "freetype")
ft_prefix = None

if ft_prefix and os.path.isdir(ft_prefix):
# freetype might not be linked into Homebrew's prefix
_add_directory(library_dirs, os.path.join(ft_prefix, "lib"))
_add_directory(include_dirs, os.path.join(ft_prefix, "include"))
else:
# fall back to freetype from XQuartz if
# Homebrew's freetype is missing
_add_directory(library_dirs, "/usr/X11/lib")
_add_directory(include_dirs, "/usr/X11/include")
if prefix:
# add Homebrew's include and lib directories
_add_directory(library_dirs, os.path.join(prefix, "lib"))
_add_directory(include_dirs, os.path.join(prefix, "include"))
_add_directory(
include_dirs, os.path.join(prefix, "opt", "zlib", "include")
)
ft_prefix = os.path.join(prefix, "opt", "freetype")

if ft_prefix and os.path.isdir(ft_prefix):
# freetype might not be linked into Homebrew's prefix
_add_directory(library_dirs, os.path.join(ft_prefix, "lib"))
_add_directory(include_dirs, os.path.join(ft_prefix, "include"))
else:
# fall back to freetype from XQuartz if
# Homebrew's freetype is missing
_add_directory(library_dirs, "/usr/X11/lib")
_add_directory(include_dirs, "/usr/X11/include")

# Add the macOS SDK path.
sdk_path = self.get_macos_sdk_path()
Expand Down
Loading