Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using cmake extension modules alongside other extension modules #33

Open
Xiretza opened this issue Jun 11, 2022 · 5 comments
Open

Using cmake extension modules alongside other extension modules #33

Xiretza opened this issue Jun 11, 2022 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@Xiretza
Copy link
Contributor

Xiretza commented Jun 11, 2022

Unless I'm misinterpreting something, using BuildExtension as cmdclass['build_ext'] in setup.py makes any non-cmake extension modules completely ineffective, because BuildExtension.run() simply ignores them:

cmake_extensions = [e for e in self.extensions if isinstance(e, CMakeExtension)]

Is my understanding correct? How would I use this project if I also have e.g. cython extension modules?

@diegoferigo
Copy link
Owner

Hi @Xiretza, thanks for raising this point. I'm not really sure to be honest, I'm not expert in setuptools hooks and I naively assumed that each build extension should process only its own stuff. I imagine that also other build extensions implement their own BuildExtension.run method, and I assume that they also filter their instance but I might be wrong.

What's the behavior you're experiencing? Are you sure that the line you linked prevents the execution of other build extensions? Can you check on your example by adding some print statements in all run methods of the extensions you're using?

@Xiretza
Copy link
Contributor Author

Xiretza commented Jun 15, 2022

This project overrides the global build_ext:

build_ext=cmake_build_extension.BuildExtension,

As far as I can tell there can only be one build_ext, and if it filters out all modules it isn't specifically designed for, that's just not gonna work.

@diegoferigo
Copy link
Owner

Ok now I see what you mean, do you have any suggestion on how to work around this limitation?

@Xiretza
Copy link
Contributor Author

Xiretza commented Jun 15, 2022

Not really. BuildExtension.run() should probably call super().run() at some point, but that will of course try to build and install the CMakeExtensions as well.

@diegoferigo diegoferigo added the help wanted Extra attention is needed label Jul 14, 2022
@kdewald
Copy link
Collaborator

kdewald commented Sep 3, 2022

@diegoferigo you could in theory skip most of the preprocessing that is currently being done in the run function and check instance types inside build_extension and forwarding to the correct build_ext object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants