@@ -138,8 +138,17 @@ def get_libev_headers_path():
138
138
murmur3_ext = Extension ('cassandra.cmurmur3' ,
139
139
sources = ['cassandra/cmurmur3.c' ])
140
140
141
- libev_includes = ['/usr/include/libev' , '/usr/local/include' , '/opt/local/include' , '/usr/include' ]
142
- libev_libdirs = ['/usr/local/lib' , '/opt/local/lib' , '/usr/lib64' ]
141
+ is_macos = sys .platform .startswith ('darwin' )
142
+
143
+ def eval_env_var_as_array (varname ):
144
+ val = os .environ .get (varname )
145
+ return None if not val else [v .strip () for v in val .split (',' )]
146
+
147
+ DEFAULT_LIBEV_INCLUDES = ['/usr/include/libev' , '/usr/local/include' , '/opt/local/include' , '/usr/include' ]
148
+ DEFAULT_LIBEV_LIBDIRS = ['/usr/local/lib' , '/opt/local/lib' , '/usr/lib64' ]
149
+ libev_includes = eval_env_var_as_array ('CASS_DRIVER_LIBEV_INCLUDES' ) or DEFAULT_LIBEV_INCLUDES
150
+ libev_libdirs = eval_env_var_as_array ('CASS_DRIVER_LIBEV_LIBS' ) or DEFAULT_LIBEV_LIBDIRS
151
+
143
152
if is_macos :
144
153
libev_includes .extend (['/opt/homebrew/include' , os .path .expanduser ('~/homebrew/include' ), * get_libev_headers_path ()])
145
154
libev_libdirs .extend (['/opt/homebrew/lib' ])
@@ -190,7 +199,7 @@ def get_libev_headers_path():
190
199
191
200
try_extensions = "--no-extensions" not in sys .argv and is_supported_platform and is_supported_arch and not os .environ .get ('CASS_DRIVER_NO_EXTENSIONS' )
192
201
try_murmur3 = try_extensions and "--no-murmur3" not in sys .argv
193
- try_libev = try_extensions and "--no-libev" not in sys .argv and not is_pypy
202
+ try_libev = try_extensions and "--no-libev" not in sys .argv and not is_pypy and not os . environ . get ( 'CASS_DRIVER_NO_LIBEV' )
194
203
try_cython = try_extensions and "--no-cython" not in sys .argv and not is_pypy and not os .environ .get ('CASS_DRIVER_NO_CYTHON' )
195
204
try_cython &= 'egg_info' not in sys .argv # bypass setup_requires for pip egg_info calls, which will never have --install-option"--no-cython" coming fomr pip
196
205
@@ -311,6 +320,7 @@ def _setup_extensions(self):
311
320
self .extensions .append (murmur3_ext )
312
321
313
322
if try_libev :
323
+ sys .stderr .write ("Appending libev extension %s" % libev_ext )
314
324
self .extensions .append (libev_ext )
315
325
316
326
if try_cython :
0 commit comments