Reorganize conditional extensions for windows
also, don't pass gcc-specific compile options when building cython modules for windows
This commit is contained in:
53
setup.py
53
setup.py
@@ -234,36 +234,8 @@ def run_setup(extensions):
|
||||
],
|
||||
**kw)
|
||||
|
||||
extensions = []
|
||||
|
||||
if "--no-murmur3" not in sys.argv:
|
||||
extensions.append(murmur3_ext)
|
||||
|
||||
if "--no-libev" not in sys.argv:
|
||||
extensions.append(libev_ext)
|
||||
|
||||
if "--no-cython" not in sys.argv:
|
||||
try:
|
||||
from Cython.Build import cythonize
|
||||
cython_candidates = ['cluster', 'concurrent', 'connection', 'cqltypes', 'marshal', 'metadata', 'pool', 'protocol', 'query', 'util']
|
||||
extensions.extend(cythonize(
|
||||
[Extension('cassandra.%s' % m, ['cassandra/%s.py' % m], extra_compile_args=['-Wno-unused-function']) for m in cython_candidates],
|
||||
exclude_failures=True))
|
||||
except ImportError:
|
||||
warnings.warn("Cython is not installed. Not compiling core driver files as extensions (optional).")
|
||||
|
||||
if "--no-extensions" in sys.argv:
|
||||
extensions = []
|
||||
|
||||
sys.argv = [a for a in sys.argv if a not in ("--no-murmur3", "--no-libev", "--no-cython", "--no-extensions")]
|
||||
|
||||
is_windows = os.name == 'nt'
|
||||
if is_windows:
|
||||
# libev is difficult to build, and uses select in Windows.
|
||||
try:
|
||||
extensions.remove(libev_ext)
|
||||
except ValueError:
|
||||
pass
|
||||
build_extensions.error_message = """
|
||||
===============================================================================
|
||||
WARNING: could not compile %s.
|
||||
@@ -278,6 +250,31 @@ from a command prompt in the Visual Studio Tools Start Menu.
|
||||
===============================================================================
|
||||
"""
|
||||
|
||||
extensions = []
|
||||
|
||||
if "--no-murmur3" not in sys.argv:
|
||||
extensions.append(murmur3_ext)
|
||||
|
||||
if "--no-libev" not in sys.argv and not is_windows:
|
||||
extensions.append(libev_ext)
|
||||
|
||||
if "--no-cython" not in sys.argv:
|
||||
try:
|
||||
from Cython.Build import cythonize
|
||||
cython_candidates = ['cluster', 'concurrent', 'connection', 'cqltypes', 'marshal', 'metadata', 'pool', 'protocol', 'query', 'util']
|
||||
compile_args = [] if is_windows else ['-Wno-unused-function']
|
||||
extensions.extend(cythonize(
|
||||
[Extension('cassandra.%s' % m, ['cassandra/%s.py' % m], extra_compile_args=compile_args) for m in cython_candidates],
|
||||
exclude_failures=True))
|
||||
except ImportError:
|
||||
warnings.warn("Cython is not installed. Not compiling core driver files as extensions (optional).")
|
||||
|
||||
if "--no-extensions" in sys.argv:
|
||||
extensions = []
|
||||
|
||||
sys.argv = [a for a in sys.argv if a not in ("--no-murmur3", "--no-libev", "--no-cython", "--no-extensions")]
|
||||
|
||||
|
||||
platform_unsupported_msg = \
|
||||
"""
|
||||
===============================================================================
|
||||
|
||||
Reference in New Issue
Block a user