-
Notifications
You must be signed in to change notification settings - Fork 70
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
Adding support for $MESON
or another way to point at a customized Meson
#458
Comments
On the surface, adding support for looking up the meson executable via a In the Python packaging ecosystem there is the assumption that binary distributions can be compiled from source distributions with the tools specified in the package definition. There is even a proposed PEP that looks into extending this beyond Python packages and things that can be installed from PyPI. @rgommers I'm sure you are familiar with it 😃 This stops working if something not specified in A solution I used a while back for a package of mine when there were still bugs to iron out in the Meson Python support, is something like: [build-system]
build-backend = 'mesonpy'
requires = [
'meson-python',
'meson @ https://github.com/dnicolodi/meson.git',
] See this commit dnicolodi/python-siphash24@f18ab73 This ensures that the specific version of Meson is installed in the build environment, and the Why doesn't something like this work for NumPy? I haven't read the linked issue in detail, but I have the impression that vendoring Meson into NumPy made the problem harder to solve because the vendored Meson cannot be (easily, at least) installed before compiling NumPy. Am I missing something? |
The solution proposed above sucks for distributions where the build tools required to build a distribution package need to be packaged themselves. In this case, the distribution would need to merge the patches from the "friendly fork" into their Meson package, or they would need to have an additional I admit that this is not ideal, but it looks better than the alternatives, IMHO. Producing the |
Only if it's not part of your own package. It's one or the other:
There's trade-offs involved, but there's good reasons (explained below) for why I went with (1) instead of (2).
Indeed, pointing at a fork in a git repo is very convenient while developing a feature or bug fix (and is exactly what we did for numpy). It clearly cannot work for distribution a release though, you have to change to one of the two methods listed above.
Yes, the vendored Meson cannot be installed if you vendor it - it must be run straight from the source tree of your package.
This is the alternative solution, but is exactly what I'm trying to avoid. The impact of this is pretty bad:
In contrast, with the |
I was going to suggest that a possible solution is to use the path to the vendored meson in [build-system]
build-backend = 'mesonpy'
requires = [
'meson-python',
'meson @ file://_vendored/meson',
] but |
I'm not sure this checks against the PEP specification, but it works: [build-system]
build-backend = 'mesonpy'
requires = [
'meson-python',
'_vendored/meson',
] |
That does seem to work for me on Linux with I'm also still a little confused about why we wouldn't implement |
If they don't use
I don't have anything against implementing |
It will probably work in a cross platform fashion because Windows usually just accepts forward slashes or backslashes just fine. However, it's guaranteed to not work by the spec, since PEP 518 mandates that it is only permissible to list PEP 508 dependency specifiers. The fact that it works anyway is a build frontend bug -- and for the record, the bug is that The inconsistency is bad, and it's explicitly spelled out in a comment in |
It is problematic imho, we're then back to the "impact of this is pretty bad" of #458 (comment). I really want to avoid creating any work or problems for distro packagers. Disabling build isolation is standard practice for pretty much all distros, they're by design not going to download stuff from PyPI. |
You're correct there. In my first comment I said "the main thing to decide is what the UX for this should look like." I think it requires something like a |
PR submitted as pypa/build#665 |
The hack I proposed (which is indeed just a hack) does not download anything from PyPI. It installs the vendored Meson copy. But I understand that it is still weird to have to install the vendored build tool. I was not really proposing this as a solution for building distribution packages. |
Thank you @eli-schwartz for killing my hack immediately 🤣 |
I'll try and open a PR with my preferred solution for this. It should be pretty minimal. That will hopefully allow unvendoring |
Allow using a MESON environment variable, analogous to the NINJA one, or a string to an executable or Python script in the `[tool.meson-python]` section of pyproject.toml Closes mesonbuildgh-458
Allow using a MESON environment variable, analogous to the NINJA one, or a string to an executable or Python script in the `[tool.meson-python]` section of pyproject.toml Closes mesonbuildgh-458
Allow using a MESON environment variable, analogous to the NINJA one, or a string to an executable or Python script in the `[tool.meson-python]` section of pyproject.toml Closes mesonbuildgh-458
Allow using a MESON environment variable, analogous to the NINJA one, or a string to an executable or Python script in the `[tool.meson-python]` section of pyproject.toml Closes mesonbuildgh-458
Allow using a MESON environment variable, analogous to the NINJA one, or a string to an executable or Python script in the `[tool.meson-python]` section of pyproject.toml Closes mesonbuildgh-458
Allow using a MESON environment variable, analogous to the NINJA one, or a string to an executable or Python script in the `[tool.meson-python]` section of pyproject.toml Closes mesonbuildgh-458
In NumPy we had to vendor Meson in order to include a major new feature (for SIMD support) that is not yet available in Meson itself. That is fine, that's how it's supposed to work, since Meson isn't extensible by design - the point is to keep things simple and upstream your needed features/changes.
However, using that vendored Meson also forced us to vendor
meson-python
. The only reason for that was to be able to point at the correctmeson
executable. So ideallymeson-python
would have a way for a package to point at that custom Meson instead. This could be done via aMESON
environment variable (similar to theNINJA
one), and/or in some other way (a setting inpyproject.toml
perhaps.Part of what's needed here is being able to point at a
meson.py
(as shipped with Meson itself), and havemeson-python
translate that to[sys.executable, 'path/to/meson.py']
. This has to do with it being a problem on Windows to ship an executable filemeson
and have it recognized. See numpy/numpy#24379 (comment) and following comments for details.This idea was also touched upon in gh-323. It's related but not the same, so I thought I'd open a separate issue instead. The implementation is probably quite simply, the main thing to decide is what the UX for this should look like.
The text was updated successfully, but these errors were encountered: