Skip to content

Commit dbd4ea5

Browse files
authored
PYTHON-1378 Expand search directories for includes (#1198)
1 parent 7e0923a commit dbd4ea5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

setup.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,22 @@ class BuildFailed(Exception):
138138
def __init__(self, ext):
139139
self.ext = ext
140140

141+
is_windows = sys.platform.startswith('win32')
142+
is_macos = sys.platform.startswith('darwin')
141143

142144
murmur3_ext = Extension('cassandra.cmurmur3',
143145
sources=['cassandra/cmurmur3.c'])
144146

147+
libev_includes = ['/usr/include/libev', '/usr/local/include', '/opt/local/include', '/usr/include']
148+
libev_libdirs = ['/usr/local/lib', '/opt/local/lib', '/usr/lib64']
149+
if is_macos:
150+
libev_includes.extend(['/opt/homebrew/include', os.path.expanduser('~/homebrew/include')])
151+
libev_libdirs.extend(['/opt/homebrew/lib'])
145152
libev_ext = Extension('cassandra.io.libevwrapper',
146153
sources=['cassandra/io/libevwrapper.c'],
147-
include_dirs=['/usr/include/libev', '/usr/local/include', '/opt/local/include', '/opt/homebrew/include', os.path.expanduser('~/homebrew/include')],
154+
include_dirs=libev_includes,
148155
libraries=['ev'],
149-
library_dirs=['/usr/local/lib', '/opt/local/lib'])
156+
library_dirs=libev_libdirs)
150157

151158
platform_unsupported_msg = \
152159
"""
@@ -169,8 +176,6 @@ def __init__(self, ext):
169176
=================================================================================
170177
"""
171178

172-
is_windows = os.name == 'nt'
173-
174179
is_pypy = "PyPy" in sys.version
175180
if is_pypy:
176181
sys.stderr.write(pypy_unsupported_msg)

0 commit comments

Comments
 (0)