Skip to content

Commit

Permalink
MAINT: put back mesonpy.__version__
Browse files Browse the repository at this point in the history
The module constant has been used to check meson-python version in
other projects, see discussion on mesonbuild#691.  Add a test to ensure that the
version recorded in pyproject.toml and mesonpy/__init__.py are kept in
sync.
  • Loading branch information
dnicolodi committed Jan 27, 2025
1 parent 077e3bc commit 383b19b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mesonpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class InvalidLicenseExpression(Exception): # type: ignore[no-redef]
MesonArgs = Mapping[MesonArgsKeys, List[str]]


__version__ = "0.18.0.dev0"


_PYPROJECT_METADATA_VERSION = tuple(map(int, pyproject_metadata.__version__.split('.')[:2]))
_SUPPORTED_DYNAMIC_FIELDS = {'version', } if _PYPROJECT_METADATA_VERSION < (0, 9) else {'version', 'license', 'license-files'}

Expand Down
8 changes: 8 additions & 0 deletions tests/test_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
import pathlib
import sys

import mesonpy

if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib


def test_version():
pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')
with open(pyproject, 'rb') as f:
project_version = tomllib.load(f)['project']['version']
assert mesonpy.__version__ == project_version


def test_pyproject_dependencies():
pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')
with open(pyproject, 'rb') as f:
Expand Down

0 comments on commit 383b19b

Please sign in to comment.