diff --git a/setup.py b/setup.py index 8a73436..f5ce000 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,14 @@ class build_ext_with_resolver(build_ext): self.force = os.getenv("KLOOP_FORCE", "0") == "1" for ext in self.distribution.ext_modules: + if ext.cython_directives: + ext.cython_directives["language_level"] = "3" + else: + ext.cython_directives = {"language_level": "3"} + if ext.cython_compile_time_env: + ext.cython_compile_time_env["DEBUG"] = self.debug + else: + ext.cython_compile_time_env = {"DEBUG": self.debug} if self.debug: if "-O0" not in ext.extra_compile_args: ext.extra_compile_args.append("-O0") @@ -49,10 +57,6 @@ class build_ext_with_resolver(build_ext): if resolver not in ext.depends: ext.depends.append(resolver) - self.distribution.ext_modules = cythonize( - self.distribution.ext_modules, language_level="3", - ) - super().finalize_options() def run(self): @@ -118,22 +122,16 @@ setup( ], include_dirs=[ d.strip().removeprefix("-I") - for d in sysconfig.get_config_var( - "OPENSSL_INCLUDES" - ).split() + for d in sysconfig.get_config_var("OPENSSL_INCLUDES").split() ], library_dirs=[ d.strip().removeprefix("-L") - for d in sysconfig.get_config_var( - "OPENSSL_LDFLAGS" - ).split() + for d in sysconfig.get_config_var("OPENSSL_LDFLAGS").split() if d.strip().startswith("-L") ], extra_link_args=[ d.strip() - for d in sysconfig.get_config_var( - "OPENSSL_LDFLAGS" - ).split() + for d in sysconfig.get_config_var("OPENSSL_LDFLAGS").split() if not d.strip().startswith("-L") ], runtime_library_dirs=(lambda x: [x] if x else [])( diff --git a/src/kloop/tls.pyx b/src/kloop/tls.pyx index 8232a22..6706526 100644 --- a/src/kloop/tls.pyx +++ b/src/kloop/tls.pyx @@ -45,7 +45,6 @@ cdef unsigned char FLAGS_PROXY_RECV_ALL = ( ) cdef size_t CMSG_SIZE = libc.CMSG_SPACE(sizeof(unsigned char)) -DEF DEBUG = 0 cdef inline void reset_msg(libc.msghdr* msg, void* cmsg) nogil: