Skip to content

Commit fc5faa7

Browse files
committed
MAINT: synchronize meson version requirements
Make the runtime version check the same as the dependency declaration in pyproject.toml and add a test to verify the equivalence. Requiring 0.64 over 0.63.3 was mostly a cosmetic change to allow to write `import('python').find_installation(pure: false)` in the test packages, thus the runtime version check was not update in sync to allow to use the older meson for a while longer in special settings. The old meson version should have been retired by now, and keeping the version checks consistent is less confusing.
1 parent f489fa3 commit fc5faa7

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

mesonpy/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ class InvalidLicenseExpression(Exception): # type: ignore[no-redef]
9292
_SUPPORTED_DYNAMIC_FIELDS = {'version', } if _PYPROJECT_METADATA_VERSION < (0, 9) else {'version', 'license', 'license-files'}
9393

9494
_NINJA_REQUIRED_VERSION = '1.8.2'
95-
_MESON_REQUIRED_VERSION = '0.63.3' # keep in sync with the version requirement in pyproject.toml
95+
96+
# Keep in sync with the version requirement in pyproject.toml
97+
_MESON_REQUIRED_VERSION = '0.64.0' if sys.version_info < (3, 12) else '1.2.3'
9698

9799
_MESON_ARGS_KEYS = ['dist', 'setup', 'compile', 'install']
98100

tests/test_consistency.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import pathlib
66
import sys
77

8+
from packaging import requirements, specifiers
9+
810

911
if sys.version_info >= (3, 11):
1012
import tomllib
@@ -30,3 +32,13 @@ def test_pyproject_dependencies():
3032
# verify that all build dependencies are project dependencies
3133
assert not set(build_dependencies) - set(project_dependencies), \
3234
'pyproject.toml is inconsistent: not all "build-system.requires" are in "project.dependencies"'
35+
36+
37+
def test_meson_version_requirement():
38+
pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')
39+
with open(pyproject, 'rb') as f:
40+
data = tomllib.load(f)
41+
for dep in data['project']['dependencies']:
42+
req = requirements.Requirement(dep)
43+
if req.name == 'meson' and req.marker.evaluate():
44+
assert req.specifier == specifiers.SpecifierSet(f'>= {mesonpy._MESON_REQUIRED_VERSION}')

0 commit comments

Comments
 (0)