@@ -234,16 +234,28 @@ def run_setup(extensions):
234234 ],
235235 ** kw )
236236
237- extensions = [murmur3_ext , libev_ext ]
237+ extensions = []
238+
239+ if "--no-murmur3" not in sys .argv :
240+ extensions .append (murmur3_ext )
241+
242+ if "--no-libev" not in sys .argv :
243+ extensions .append (libev_ext )
244+
245+ if "--no-cython" not in sys .argv :
246+ try :
247+ from Cython .Build import cythonize
248+ cython_candidates = ['cluster' , 'concurrent' , 'connection' , 'cqltypes' , 'marshal' , 'metadata' , 'pool' , 'protocol' , 'query' , 'util' ]
249+ extensions .extend (cythonize (
250+ [Extension ('cassandra.%s' % m , ['cassandra/%s.py' % m ], extra_compile_args = ['-Wno-unused-function' ]) for m in cython_candidates ],
251+ exclude_failures = True ))
252+ except ImportError :
253+ warnings .warn ("Cython is not installed. Not compiling core driver files as extensions (optional)." )
254+
238255if "--no-extensions" in sys .argv :
239- sys .argv = [a for a in sys .argv if a != "--no-extensions" ]
240256 extensions = []
241- elif "--no-murmur3" in sys .argv :
242- sys .argv = [a for a in sys .argv if a != "--no-murmur3" ]
243- extensions .remove (murmur3_ext )
244- elif "--no-libev" in sys .argv :
245- sys .argv = [a for a in sys .argv if a != "--no-libev" ]
246- extensions .remove (libev_ext )
257+
258+ sys .argv = [a for a in sys .argv if a not in ("--no-murmur3" , "--no-libev" , "--no-cython" , "--no-extensions" )]
247259
248260is_windows = os .name == 'nt'
249261if is_windows :
0 commit comments