Uh oh!
There was an error while loading. Please reload this page.
ENH: do not check extension module file name against expected suffix - #322
Conversation
Checking that the extensions modules filenames end with a suffix accepted by the current Python interpreter assumes that the wheel being assembled is for the same Python platform. This is not true when cross-compiling. The check protects against a very unlikely occurrence and makes life harder for tools that allow cross-compiling Python wheels. Remove it. See mesonbuild#321.
rgommers
commented
Feb 26, 2023
+1 for doing this. We can either remove the check completely, or remove it when we know we're cross-compiling. Which is something that I think we anyway need to know - we already do know on macOS, and outside of macOS it's a matter of checking for a cross file in config-settings. |
dnicolodi
commented
Mar 1, 2023
I added the check, but I came to the conclusion that it is not a good idea. Among other things, it prevents installing a data file in |
FFY00
commented
Mar 1, 2023
A data file that ends with |
dnicolodi
commented
Mar 1, 2023
Oh, you are right. I forgot about the double extension check. However, if someone goes into the trouble of putting something that looks like a Python extension module for the wront interpreter version in |
doronbehar
commented
Mar 17, 2023
Thanks @rgommers for linking this PR from #321, I missed it somehow when browsing #321. While thinking my self how can I fix this issue with a patch applied upon the First of all (easy), the docstring wasn't trimmed: diff --git i/mesonpy/__init__.py w/mesonpy/__init__.py
index 78db5d8..5832d4e 100644
--- i/mesonpy/__init__.py+++ w/mesonpy/__init__.py@@ -341,10 +341,6 @@ class _WheelBuilder():
and .so on other platforms) and, if they all share the same
PEP 3149 filename stable ABI tag, return it.
- All files that look like extension modules are verified to- have a file name compatibel with what is expected by the- Python interpreter. An exception is raised otherwise.-
Other files are ignored.
"""Secondly, this meson-python/mesonpy/__init__.py Lines 351 to 355 in 961fb56 Doesn't assume that the "Host" machine and "Build" / "Target" machine have the same "shared object" file extension ( |
rgommers
commented
Mar 17, 2023
Good points, thanks @doronbehar.
It's not too much to ask - I'm hoping we can make that work at some point. But in practice it's not that common to do that, so it may take a while before we need to work around this one. In the meantime, there's some bigger cross-compilation fish to fry, in Meson itself and in dealing with |
doronbehar
commented
Mar 17, 2023
Here's a small fixup PR with docstring and a comment to that condition: #349 |
Checking that the extensions modules filenames end with a suffix accepted by the current Python interpreter assumes that the wheel being assembled is for the same Python platform. This is not true when cross-compiling. The check protects against a very unlikely occurrence and makes life harder for tools that allow cross-compiling Python wheels. Remove it.
See #321.