-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Replace dots with underscores in f2py meson backend for lib identifiers #26634
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
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 8000 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. |
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.
This is a pragmatic change, thanks for the fix @mathomp4 but since we don't have a nice way to have a concrete test for this, maybe a comment pointing to the issue / pr?
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
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.
Thanks for working on this @mathomp4 , LGTM, will merge after the CI run finishes.
@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.base
as saying this is thebase
method in theMAPL
type (or class?). Thus, it expects parentheses.So this PR uses a
replace()
call to replace all the.
to_
in thelib
identifier. This has to be done both in thedeclare_dependency
and in thedependencies
bit 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.x
if desired.