def _setup_extensions(self):
# We defer extension setup until this command to leveraage 'setup_requires' pulling in Cython before we
# attempt to import anything
self.extensions = []
if try_murmur3:
self.extensions.append(murmur3_ext)
if try_libev:
self.extensions.append(libev_ext)
if try_cython:
try:
from Cython.Build import cythonize
cython_candidates = ['cluster', 'concurrent', 'connection', 'cqltypes', 'metadata',
'pool', 'protocol', 'query', 'util']
compile_args = [] if is_windows else ['-Wno-unused-function']
self.extensions.extend(cythonize(
[Extension('cassandra.%s' % m, ['cassandra/%s.py' % m],
extra_compile_args=compile_args)
for m in cython_candidates],
nthreads=build_concurrency,
exclude_failures=True))
self.extensions.extend(cythonize(NoPatchExtension("*", ["cassandra/*.pyx"], extra_compile_args=compile_args),
nthreads=build_concurrency))
except Exception:
sys.stderr.write("Failed to cythonize one or more modules. These will not be compiled as extensions (optional).\n")
评论列表
文章目录