From 7e2c1b8f02bcf4d71d86b7446a065a29d4d6e1e8 Mon Sep 17 00:00:00 2001 From: RA80533 <32469082+RA80533@users.noreply.github.com> Date: Thu, 27 Apr 2023 14:38:21 -0400 Subject: [PATCH 1/2] Use `HOMEBREW_PREFIX` to locate Homebrew --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 3f150612..32ef69ec 100755 --- a/setup.py +++ b/setup.py @@ -217,6 +217,9 @@ def get_compiler_settings(version_str): '/opt/homebrew/include', expanduser('~/homebrew/include'), ] + _HOMEBREW_PREFIX = os.environ.get('HOMEBREW_PREFIX') + if _HOMEBREW_PREFIX is not None: + dirs.insert(0, os.path.join(_HOMEBREW_PREFIX, 'include')) settings['include_dirs'].extend(dir for dir in dirs if isdir(dir)) # unixODBC make/install places libodbc.dylib in /usr/local/lib/ by default # ( also OS/X since El Capitan prevents /usr/lib from being accessed ) From ccef94b049b0f903799ae1f282aade67cdafa5a5 Mon Sep 17 00:00:00 2001 From: RA80533 <32469082+RA80533@users.noreply.github.com> Date: Thu, 27 Apr 2023 18:20:46 -0400 Subject: [PATCH 2/2] Use `HOMEBREW_PREFIX` for linking if set --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 32ef69ec..253d1e08 100755 --- a/setup.py +++ b/setup.py @@ -224,6 +224,8 @@ def get_compiler_settings(version_str): # unixODBC make/install places libodbc.dylib in /usr/local/lib/ by default # ( also OS/X since El Capitan prevents /usr/lib from being accessed ) settings['library_dirs'] = ['/usr/local/lib', '/opt/homebrew/lib'] + if _HOMEBREW_PREFIX is not None: + settings['library_dirs'].insert(1, os.path.join(_HOMEBREW_PREFIX, 'lib')) else: # Other posix-like: Linux, Solaris, etc.