Skip to content

Add temporary escape hatch for customization wheel generation? #259

Closed
@HDembinski

Description

@HDembinski

I am trying to port my project pyhepmc scikit-hep/pyhepmc#57 to meson/meson-python.

I am building a Python extension module and a library (a dependency). I compile the library myself. What I would like to do is to compile the library as a shared library and ship it with the Python module. The library has to be a shared library, not a static library or compiled directly into my app, to respect the LGPL license (my project is released under a less restrictive license than the library). meson-python informs me that this is only supported for Linux at the moment.

        File "/Users/hdembinski/Extern/meson-python/.mesonpy/editable/install/opt/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/mesonpy/__init__.py", line 561, in build
          assert platform.system() == 'Linux', 'Bundling libraries in wheel is currently only supported in POSIX!'

I looked into the source code and the reason for this seems to be that there are no tools implemented yet to change RPATH on MacOS and Windows.

I am willing to live with a workaround until this is supported officially. Is it possible to implement an escape hatch as a temporary solution which allows me to put the shared library into the Python extension directory and allow me to run a custom command to change the RPATH in the Python extension module?

I would like to control the location where the library is installed, because I think that the RPATH in the Python extension module may actually support loading the library from the same directory where the extension module is located. What I have in mind is a undocumented configuration setting, that allows me to specify the location of the library and another setting to run a custom python script on the python extension module. Setting this should bypass the assert, too.

Or is there maybe another solution to my problem? I tried a few workarounds. I got pretty far with integrating the library via <dependency>.as_link_whole(), which works on Linux and MacOS, but fails on Windows. This still violates the LGPL, though, so it is not a proper solution.

Link to my meson.build https://github.com/scikit-hep/pyhepmc/blob/3d5372824e08e1cd4317eda6dd924ea649d68984/meson.build

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions