Skip to content

BLD: Ensure meson.build has the right version of Python #29997

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

Merged
merged 1 commit into from
May 2, 2025

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented May 1, 2025

PR summary

If python3 is in the path, it might be picked up instead of the one used to build. This is the case on GitHub actions, where cibuildwheel seems to explicitly call the Python (3.11+) it wants, but python3 is in the hosted tool cache as an older version (3.9) that gets picked by Meson. This matters because we need to run setuptools_scm to produce the version, and it may not be installed in the PATH-based copy.

By specifying the version, Meson should skip the PATH option, and choose its final fallback, the interpreter that it is itself running on. While still not guaranteed to be correct everywhere, this should at least work for CI.

PR checklist

@QuLogic QuLogic added Build CI: Run cibuildwheel Run wheel building tests on a PR labels May 1, 2025
@QuLogic QuLogic added this to the v3.10.2 milestone May 1, 2025
@github-actions github-actions bot removed the CI: Run cibuildwheel Run wheel building tests on a PR label May 1, 2025
@QuLogic QuLogic added the CI: Run cibuildwheel Run wheel building tests on a PR label May 1, 2025
If `python3` is in the path, it might be picked up instead of the one
used to build. This is the case on GitHub actions, where cibuildwheel
seems to explicitly call the Python (3.11+) it wants, but `python3` is
in the hosted tool cache as an older version (3.9) that gets picked by
Meson. This matters because we need to run `setuptools_scm` to produce
the version, and it may not be installed in the `PATH`-based copy.

By specifying the version, Meson should skip the `PATH` option, and
choose its final fallback, the interpreter that it is itself running on.
While still not guaranteed to be correct everywhere, this should at
least work for CI.
@github-actions github-actions bot removed the CI: Run cibuildwheel Run wheel building tests on a PR label May 1, 2025
@QuLogic QuLogic added the CI: Run cibuildwheel Run wheel building tests on a PR label May 1, 2025
@QuLogic
Copy link
Member Author

QuLogic commented May 1, 2025

As an addendum, it seems like the fallback I was hoping for didn't work (possibly a bug in Meson to fix?) However, adding python as another explicit fallback did work, since the tool cache only has python3.

@timhoffm timhoffm merged commit 440eb61 into matplotlib:main May 2, 2025
52 checks passed
Copy link

lumberbot-app bot commented May 2, 2025

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.10.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 440eb61accb18de4a2270b44831d646a09a8e196
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #29997: BLD: Ensure meson.build has the right version of Python'
  1. Push to a named branch:
git push YOURFORK v3.10.x:auto-backport-of-pr-29997-on-v3.10.x
  1. Create a PR against branch v3.10.x, I would have named this PR:

"Backport PR #29997 on branch v3.10.x (BLD: Ensure meson.build has the right version of Python)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@QuLogic QuLogic deleted the cibw-windows branch May 2, 2025 08:44
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request May 2, 2025
@QuLogic
Copy link
Member Author

QuLogic commented May 2, 2025

Conflict was expected due to the differing Python requirements; backport is #29999.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build CI: Run cibuildwheel Run wheel building tests on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants