-
Notifications
You must be signed in to change notification settings - Fork 68
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
ENH: support shared libraries on Windows when explicitly enabled #551
Conversation
d8e872a
to
1778ab6
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.
This looks like a good approach, I like it. A couple of thoughts:
-
Internal shared libraries can be made to work today already in a package using
meson-python
, when explicitly installing the shared library without the package and usingdelvewheel
(in an elaborate way) andinstall_rpath
on other platforms, as demonstrated by BUG: Fix for scipy.special seterr, geterr, errstate scipy/scipy#20321. I think this PR is fine as is; I did have a concern that not having the option set shouldn't start raising an exception, so let's make sure that that remains the case. -
As @QuLogic commented, it'd be good to elaborate on the best ways for a package to do this. I think there are two:
- Using
os.add_dll_directory
, which should be reliable on Python >= 3.10 - Preloading the DLL with
ctypes.WinDLL
- we've done this for a long time in NumPy and SciPy already for external shared libraries: https://github.com/scipy/scipy/blob/bb92c8014e21052e7dde67a76b28214dd1dcb94a/tools/openblas_support.py#L239-L274 (it should require fewer lines of code for an internal shared library that will always be present)
- Using
With the documentation work done in #700 it is time to revisit this, I think. I think this PR is a good approach and the implementation is simple enough. However, I really don't like the option name I came up with. Does anyone have a better idea? |
A good descriptive name is not so easy. Ideally the name should make clear it's a boolean and allows meson-python to fold internal shared libraries targeted for install outside site-packages into the wheel on Windows. That's too much info though. Although |
1778ab6
to
e9fc340
Compare
I've adjusted the option name and updated the documentation. Please have a look. |
de3234b
to
d7af1d7
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.
The added docs and the option name look quite good to me, as do the code changes.
The docs CI job has a complaint still. And it seems like test coverage still needs to be added.
e1a38a6
to
555bd6d
Compare
Thanks for the review @rgommers I didn't add tests because I didn't want to deal with compilation with MSVC... I added them and indeed I have no idea why MSVC complains during linking (there is an issue with an invalid linker argument that I'll fix, but that does not seem to be the cause of the link failure). Any help would be appreciated |
41a2827
to
043657b
Compare
All green! |
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 looks good to go, nice work! Glad adding the test wasn't too much trouble.
One more docs suggestion inline.
One test suggestion here: the first commit and the FreeBSD patchelf
addition show that RPATH handling works fine on FreeBSD now, so it may be nice to add freebsd
to these lines in test_wheel.py
:
@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform')
Both of these are optional suggestions - happy for this to be merged as is if you prefer.
Indeed. I'll do |
2c0d431
to
9d05167
Compare
Assume all platforms except Windows and macOS use ELF binaries.
9d05167
to
047a696
Compare
🎉 nice work! |
No description provided.