absurdfarce commented on code in PR #1271:
URL: 
https://github.com/apache/cassandra-python-driver/pull/1271#discussion_r2835060501


##########
setup.py:
##########
@@ -66,62 +67,59 @@
     pyproject_data = toml.load(f)
 driver_project_data = pyproject_data["tool"]["cassandra-driver"]
 
-murmur3_ext = Extension('cassandra.cmurmur3', sources=['cassandra/cmurmur3.c'])
-
-DEFAULT_LIBEV_INCLUDES = ['/usr/include/libev', '/usr/local/include', 
'/opt/local/include', '/usr/include']
-DEFAULT_LIBEV_LIBS = ['/usr/local/lib', '/opt/local/lib', '/usr/lib64']
-libev_includes = driver_project_data["libev-includes"] or 
DEFAULT_LIBEV_INCLUDES
-libev_libs = driver_project_data["libev-libs"] or DEFAULT_LIBEV_LIBS
-if is_macos:
-    libev_includes.extend(['/opt/homebrew/include', 
os.path.expanduser('~/homebrew/include')])
-    libev_libs.extend(['/opt/homebrew/lib'])
-libev_ext = Extension('cassandra.io.libevwrapper',
-                      sources=['cassandra/io/libevwrapper.c'],
-                      include_dirs=libev_includes,
-                      libraries=['ev'],
-                      library_dirs=libev_libs)
-
-try_murmur3 = driver_project_data["build-murmur3-extension"] and 
is_supported_platform and is_supported_arch
-try_libev = driver_project_data["build-libev-extension"] and 
is_supported_platform and is_supported_arch
-try_cython = driver_project_data["build-cython-extensions"] and 
is_supported_platform and is_supported_arch and not is_pypy
+def key_or_false(k):
+    return driver_project_data[k] if k in driver_project_data else False
+
+try_murmur3 = key_or_false("build-murmur3-extension") and is_supported
+try_libev = key_or_false("build-libev-extension") and is_supported
+try_cython = key_or_false("build-cython-extensions") and is_supported and not 
is_pypy
 
 build_concurrency = driver_project_data["build-concurrency"]
 
-def build_extension_list():
-
-    rv = []
-
-    if try_murmur3:
-        sys.stderr.write("Appending murmur extension %s\n" % murmur3_ext)
-        rv.append(murmur3_ext)
-
-    if try_libev:
-        sys.stderr.write("Appending libev extension %s\n" % libev_ext)
-        rv.append(libev_ext)
-
-    if try_cython:
-        sys.stderr.write("Trying Cython builds in order to append Cython 
extensions\n")
-        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']
-            rv.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))
-
-            rv.extend(cythonize(Extension("*", ["cassandra/*.pyx"], 
extra_compile_args=compile_args),
-                                          nthreads=build_concurrency))
-        except Exception as exc:
-            sys.stderr.write("Failed to cythonize one or more modules. These 
will not be compiled as extensions (optional).\n")
-            sys.stderr.write("Cython error: %s\n" % exc)
-    
-    return rv
+exts = []
+if try_murmur3:
+    murmur3_ext = Extension('cassandra.cmurmur3', 
sources=['cassandra/cmurmur3.c'])
+    sys.stderr.write("Appending murmur extension %s\n" % murmur3_ext)
+    exts.append(murmur3_ext)
+
+if try_libev:
+    libev_includes = driver_project_data["libev-includes"]
+    libev_libs = driver_project_data["libev-libs"]
+    if is_macos:
+        libev_includes.extend(['/opt/homebrew/include', 
os.path.expanduser('~/homebrew/include')])
+        libev_libs.extend(['/opt/homebrew/lib'])
+    libev_ext = Extension('cassandra.io.libevwrapper',
+                          sources=['cassandra/io/libevwrapper.c'],
+                          include_dirs=libev_includes,
+                          libraries=['ev'],
+                          library_dirs=libev_libs,
+                          runtime_library_dirs=libev_libs)

Review Comment:
   Confirmed that build still looks good after removal of this option so we're 
going to go without it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to