BUG: Replace dots with underscores in f2py meson backend for lib identifiers#26634
Conversation
|
Yes! Cirlce CI has reported a false positive from a previous merge. Merging #26633 should fix this issue. |
|
Also for the admins: should I make changes to the "numpy with meson" docs for this PR as well? It seems a bit "internal" since it doesn't really change anything in how f2py is called so probably not but let me know. |
If there's no user-facing impact I don't think there's any need to mention it in the docs. I'm not familiar with f2py so can't help otherwise with the review but thought I'd add that bit of context. |
|
I can report that the end user of this code said things worked for her with the fix, so that's nice. |
Well this: #26623 does seem to show the issue. But even simpler, take this code as now try and run It's not like From my reading of the Meson Grammar, a dot in a variable means a method expression: so: foo.bar = ...dies because meson is expecting that means the next character must be a left paren. |
On creating incorrect meson.build files Co-authored-by: mathomp4 <mathomp4@users.noreply.github.com>
f52f57c to
a48ce39
Compare
|
@charris as a regression (from distutils to meson) this might need a backport. |
As seen in #26623, if a library itself has a dot, e.g.,
-lMAPL.base, then the meson backend produces code like:But meson apparently sees
MAPL.baseas saying this is thebasemethod in theMAPLtype (or class?). Thus, it expects parentheses.So this PR uses a
replace()call to replace all the.to_in thelibidentifier. This has to be done both in thedeclare_dependencyand in thedependenciesbit ofpy.extension_module.With this fix I get:
This seems to fix any issues in my testing, but my fear is cases I don't have. (Though perhaps libraries with dots is a rare case anyway and mainly a style used in the our code.)
Closes #26623
NOTE: I tested this with Numpy 1.26.4, and I see main is now in v2 land. It would be nice to get this into a v1 tag as well if v2 is still a ways off. I could backport this to
maintenance/1.26.xif desired.