-
Notifications
You must be signed in to change notification settings - Fork 3
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
Meson: detect changes in .pxd .pyx .pxi files #29
Comments
Change .cpp compilation -- add
|
Change .so generating -- add
|
So is there a way of making meson detect changes in.pxd and .pxi files, however clunky? If there is, let's use it and talk to meson devs with the current way and a desired way. |
BTW, how does meson handle C header files? I cannot believe it does not detect changes in those |
Add .pxd as dependency_rndm_pxd = custom_target('_rndm_pxd',
output : 'rndm.pxd',
input : 'rndm.pxd',
command : ['cp', '@INPUT@', '@OUTDIR@'],
)
cython_rndm_pxd = declare_dependency(sources: _rndm_pxd)
py3.extension_module(
'rndm', _rndm_cpp,
include_directories: inc_np,
dependencies : [py3_dep, cython_rndm_pxd],
install: true,
subdir: install_dir
)
) Try without adding syntax errors: The same result, as with the current build |
../mc_lib/_observable/observable.h:29:5: error: ‘terrible’ does not name a type
29 | terrible mistake
| ^~~~~~~~ Caught it |
I found a solution:You need to use
Flags: Example:
# implementation details
cdef void _fill(self) nogil
terrible error
FAILED: mc_lib/rndm.cpp
/home/casper/PycharmProjects/envs/test_meson_pxds/bin/cython --cplus -3 --fast-fail ../mc_lib/rndm.pyx -o mc_lib/rndm.cpp
Error compiling Cython file:
------------------------------------------------------------
...
cdef double uniform(self) nogil
# implementation details
cdef void _fill(self) nogil
terrible error ^
------------------------------------------------------------ |
Can one always use one of these flags? (Both less to memorize and easier to script the dev workflow) |
No, both flags seeking the named folder, where build is. So for the first launch of the setup must be with no compilation flags. |
I think that's related to (or the same as) mesonbuild/meson#8961. I haven't yet found the time to dig in more, but it should be fixable. Basically the problem is that you can pass anything to |
ISTM it's somewhat simpler--- pyx/pxd files are just like h/cpp pairs, which are tracked by meson, right? |
Well Meson emits |
So I take it it's an meson upstream ticket material? |
Oh one thing to check first, normally dependencies get tracked automatically, but not for
See the description of |
Bingo! gh-35 seems to do it. Steps to reproduce
This passes on master and fails with gh-35. Somehow breaking |
This should explain it: https://ninja-build.org/manual.html#ref_headers.
py3.install_sources(
'observable.h',
pure: false,
subdir: 'mc_lib/_observable'
) which means install some source file install a "python install". There are other general Meson commands like |
Thanks Ralf! |
I want syntax error checks and changes detection in
.pxd
files from meson during the developing process.For my experiment, I choose rndm files.
I use that sequence of commands:
Current build:
print('some useful content')
atrndm.pxd
setup > Directory already configured.
compile > ninja: no work to do.
install: do the installation
Result: I get new line in installdir/.../rndm.pxd
rndm.pxd
setup > Directory already configured.
compile > ninja: no work to do.
install: do the installation
Result: I get new line with syntax error in installdir/.../rndm.pxd
rndm.pyx
setup > Directory already configured.
compile > Error compiling Cython file
The text was updated successfully, but these errors were encountered: