Skip to content

Commit 7cd2d5b

Browse files
committed
BLD: Ensure meson.build has the right version of Python
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.
1 parent fa3e9da commit 7cd2d5b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

meson.build

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
project(
22
'matplotlib',
33
'c', 'cpp',
4-
version: run_command(find_program('python3'), '-m', 'setuptools_scm', check: true).stdout().strip(),
4+
version: run_command(
5+
# Also keep version in sync with pyproject.toml.
6+
find_program('python3', version: '>= 3.11'),
7+
'-m', 'setuptools_scm', check: true).stdout().strip(),
58
# qt_editor backend is MIT
69
# ResizeObserver at end of lib/matplotlib/backends/web_backend/js/mpl.js is CC0
710
# Carlogo, STIX and Computer Modern is OFL

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ dependencies = [
4040
"pyparsing >= 3",
4141
"python-dateutil >= 2.7",
4242
]
43+
# Also keep in sync with find_program of meson.build.
4344
requires-python = ">=3.11"
4445

4546
[project.optional-dependencies]

0 commit comments

Comments
 (0)