From d14c627a7683f56fdd305e02b737c9df3b9827ef Mon Sep 17 00:00:00 2001 From: Adam Holmberg Date: Wed, 8 Jul 2015 11:56:59 -0500 Subject: [PATCH] Reorganize conditional extensions for windows also, don't pass gcc-specific compile options when building cython modules for windows --- setup.py | 53 +++++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/setup.py b/setup.py index b3754581..b5a08ab2 100644 --- a/setup.py +++ b/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 = \ """ ===============================================================================