@@ -120,8 +120,14 @@ def __init__(self, ext):
120
120
murmur3_ext = Extension ('cassandra.cmurmur3' ,
121
121
sources = ['cassandra/cmurmur3.c' ])
122
122
123
- libev_includes = ['/usr/include/libev' , '/usr/local/include' , '/opt/local/include' , '/usr/include' ]
124
- libev_libdirs = ['/usr/local/lib' , '/opt/local/lib' , '/usr/lib64' ]
123
+ def eval_env_var_as_array (varname ):
124
+ val = os .environ .get (varname )
125
+ return None if not val else [v .strip () for v in val .split (',' )]
126
+
127
+ DEFAULT_LIBEV_INCLUDES = ['/usr/include/libev' , '/usr/local/include' , '/opt/local/include' , '/usr/include' ]
128
+ DEFAULT_LIBEV_LIBDIRS = ['/usr/local/lib' , '/opt/local/lib' , '/usr/lib64' ]
129
+ libev_includes = eval_env_var_as_array ('CASS_DRIVER_LIBEV_INCLUDES' ) or DEFAULT_LIBEV_INCLUDES
130
+ libev_libdirs = eval_env_var_as_array ('CASS_DRIVER_LIBEV_LIBS' ) or DEFAULT_LIBEV_LIBDIRS
125
131
if is_macos :
126
132
libev_includes .extend (['/opt/homebrew/include' , os .path .expanduser ('~/homebrew/include' )])
127
133
libev_libdirs .extend (['/opt/homebrew/lib' ])
@@ -165,7 +171,7 @@ def __init__(self, ext):
165
171
166
172
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' )
167
173
try_murmur3 = try_extensions and "--no-murmur3" not in sys .argv
168
- try_libev = try_extensions and "--no-libev" not in sys .argv and not is_pypy and not is_windows
174
+ try_libev = try_extensions and "--no-libev" not in sys .argv and not is_pypy and not os . environ . get ( 'CASS_DRIVER_NO_LIBEV' )
169
175
try_cython = try_extensions and "--no-cython" not in sys .argv and not is_pypy and not os .environ .get ('CASS_DRIVER_NO_CYTHON' )
170
176
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
171
177
@@ -280,6 +286,7 @@ def _setup_extensions(self):
280
286
self .extensions .append (murmur3_ext )
281
287
282
288
if try_libev :
289
+ sys .stderr .write ("Appending libev extension %s" % libev_ext )
283
290
self .extensions .append (libev_ext )
284
291
285
292
if try_cython :
0 commit comments