BLD: migrate build backend from setuptools to meson-python - #2886
BLD: migrate build backend from setuptools to meson-python#2886neutrinoceros wants to merge 5 commits into
Conversation
|
The bug in meson is already patched on the dev branch, so I'll just use that (through |
|
Progress !
Interestingly, this is the order they show up, and it's supposedly the reason why that first error exists at all; meson shouldn't even attempt to build |
eli-schwartz
left a comment
There was a problem hiding this comment.
You should also add cython_args: ['-I' + meson.current_source_dir(), '-I' + meson.current_build_dir()] where relevant because all generated files happen out of the source directory, which means cython needs to know where some files are rather than finding it literally next to the compiler and/or the input. You may only need the source version, not sure offhand.
The non relative imports thing may be solved by telling cython that builddir/h5py is a genuine package, through the means of import('fs').copyfile('__init__.py'). I think cython barfs a bit when it doesn't see __init__.py files with out of source generated cython inputs. Bit annoying but such is life.
|
|
||
| py.extension_module( | ||
| 'h5py.api_types_hdf5', | ||
| template_gen.process('h5py/api_types_hdf5.pxd.template'), |
There was a problem hiding this comment.
generator.preprocess is kind of a tempting footgun IMO.
Critically, the result is generating pxd files into a private directory (builddir/h5py.api_types_hdf5.so.p/*.pxd) which means it then cannot be found by cimport in other cython files.
Custom targets are the same as generators except that they don't hide away in private directories, and also, you have to repeat arguments a bit.
There was a problem hiding this comment.
thanks ! that difference didn't register. I much rather stick with custom_target then, at least for now !
| ) | ||
|
|
||
| py.extension_module( | ||
| 'h5py.api_types_hdf5', |
There was a problem hiding this comment.
Note that you should be naming the extensions "api_types_hdf5" etc. The name is the extension name, not the import name, which gets a bit confusing for non top-level imports.
It may also be a lot easier to do this work in h5py/meson.build
There was a problem hiding this comment.
indeed, I was thinking having just one root meson.build would be easier, if less tidy, but I'm going to try nesting.
I understand the problem but the proposed solution doesn't seem to change anything visible. I still have the issue that
I don't think this worked either 😬 |
|
Probably what you want in general is to force ordering by adding the output variable of the custom target as an additional source file for the extension module which needs the pxd. This is roughly identical to the case of C generated headers. A useful experiment is to see if the build succeeds after running |
|
first time trying to use the ninja CLI directly okay I already don't know how to get pass this (I did activate my venv, and numpy is definitely installed) 😅
Already tried that, and it doesn't work either. Wouldn't it be redundant with the |
Very much a work in progress. I'm making the branch public now because I just hit what looks like a bug in meson itself, so having the PR will help provide context for a report.
blocked by
AttributeError('GeneratedList' object has no attribute 'get_builddir') mesonbuild/meson#15889TODO:
setup.py,MANIFEST.in, and any internal references to these files