@@ -138,8 +138,17 @@ def get_libev_headers_path():
138138murmur3_ext = Extension ('cassandra.cmurmur3' ,
139139 sources = ['cassandra/cmurmur3.c' ])
140140
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+
143152if is_macos :
144153 libev_includes .extend (['/opt/homebrew/include' , os .path .expanduser ('~/homebrew/include' ), * get_libev_headers_path ()])
145154 libev_libdirs .extend (['/opt/homebrew/lib' ])
@@ -190,7 +199,7 @@ def get_libev_headers_path():
190199
191200try_extensions = "--no-extensions" not in sys .argv and is_supported_platform and is_supported_arch and not os .environ .get ('CASS_DRIVER_NO_EXTENSIONS' )
192201try_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' )
194203try_cython = try_extensions and "--no-cython" not in sys .argv and not is_pypy and not os .environ .get ('CASS_DRIVER_NO_CYTHON' )
195204try_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
196205
@@ -311,6 +320,7 @@ def _setup_extensions(self):
311320 self .extensions .append (murmur3_ext )
312321
313322 if try_libev :
323+ sys .stderr .write ("Appending libev extension %s" % libev_ext )
314324 self .extensions .append (libev_ext )
315325
316326 if try_cython :
0 commit comments