-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Cython depfile support #11369
Cython depfile support #11369
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11369 +/- ##
==========================================
- Coverage 67.04% 66.25% -0.80%
==========================================
Files 414 207 -207
Lines 90542 45276 -45266
Branches 20096 9369 -10727
==========================================
- Hits 60703 29996 -30707
+ Misses 25177 12888 -12289
+ Partials 4662 2392 -2270
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
mesonbuild/backend/ninjabackend.py
Outdated
if depargs: | ||
depfile = '$out.dep' | ||
else: | ||
depfile = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write that as
depfile = '$out.dep' if depargs else None
as I find it more readable this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, and LGTM otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Thanks @eli-schwartz! This PR looks fine, but I just ran into a potentially annoying issue when testing it. Inspecting a depfile shows that the contents contain
If I uninstall Also, whenever you compile a file modulename.pyx/modulename.py, the corresponding definition file modulename.pxd is first searched for along the include path (but not sys.path), and if found, it is processed before processing the .pyx file. I think I'm missing the needed For SciPy nothing with this PR, because there we're not using |
We want to use as much default ninja behavior as we can, so reuse $out instead of repeating the output file as a string in $ARGS, and raise that into the build rule so it is only listed once.
This solves rebuild issues when e.g. importing a .pxd header from a .pyx file, just like C/C++ source headers. The transpiler needs to run again in this case. This functionality is present in the 3.0.0 alphas of cython, and is also backported to 0.29.33. Fixes mesonbuild#9049
4fad22d
to
94a190b
Compare
Indeed, sounds like Meson is successfully getting depfiles to work so all the rest is going to be passing the correct cython args to make things work. ... but does that mean that examining the depfile caused a numpy bug to be noticed? Was your build genuinely loading the wrong numpy pxds? |
I think it is a bit of a surprising behavior of Cython due to the fact that it does not distinguish between local includes and system includes. Ultimately it seems a bug in the NumPy build definition as I would have expected the compilation to fail in an isolated environment where the NumPy |
I think so, yes - but need to verify. If not, then it's a bug in the Cython depfile generation - but that seems less likely. |
Cython 0.29.33 is now out, and supports emitting depfiles for incremental rebuild detection. When support is detected, emit this in the compiler rules.
@rgommers @lithomas1 @dnicolodi
Fixes #9049