From 540a3944f66f9a208f9a24f8fbfa7c418c852de3 Mon Sep 17 00:00:00 2001 From: Kingsley Collie Date: Wed, 29 Jan 2025 21:22:42 +0000 Subject: [PATCH] Simplify building cython extension Fix attempting to compile all cython under repository directory. --- setup.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/setup.py b/setup.py index eb1fbad..b0ded18 100644 --- a/setup.py +++ b/setup.py @@ -57,22 +57,18 @@ extra_compile_args = [] extra_link_args = ["-Wl,-rpath,.", "-Wl,-rpath,{}".format(idl_library_path)] -setup_path = path.dirname(path.abspath(__file__)) +idl_core_sources = ["idlbridge/_core.pyx"] +idl_core = Extension( + "idlbridge._core", + idl_core_sources, + include_dirs=include_dirs, + libraries=libraries, + library_dirs=library_dirs, + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, +) -# build extension list -extensions = [] -for root, dirs, files in os.walk(setup_path): - for file in files: - if path.splitext(file)[1] == ".pyx": - pyx_file = path.relpath(path.join(root, file), setup_path) - module = path.splitext(pyx_file)[0].replace("/", ".") - extensions.append(Extension(module, - [pyx_file], - include_dirs=include_dirs, - libraries=libraries, - library_dirs=library_dirs, - extra_compile_args=extra_compile_args, - extra_link_args=extra_link_args)) +extensions = [idl_core] if profile: directives = {"profile": True}