Skip to content

Commit b2122f0

Browse files
committed
MAINT: put back mesonpy.__version__
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.
1 parent 077e3bc commit b2122f0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

mesonpy/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ class InvalidLicenseExpression(Exception): # type: ignore[no-redef]
7979
MesonArgs = Mapping[MesonArgsKeys, List[str]]
8080

8181

82+
__version__ = '0.18.0.dev0'
83+
84+
8285
_PYPROJECT_METADATA_VERSION = tuple(map(int, pyproject_metadata.__version__.split('.')[:2]))
8386
_SUPPORTED_DYNAMIC_FIELDS = {'version', } if _PYPROJECT_METADATA_VERSION < (0, 9) else {'version', 'license', 'license-files'}
8487

tests/test_consistency.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
else:
1212
import tomli as tomllib
1313

14+
import mesonpy
15+
16+
17+
def test_version():
18+
pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')
19+
with open(pyproject, 'rb') as f:
20+
project_version = tomllib.load(f)['project']['version']
21+
assert mesonpy.__version__ == project_version
22+
1423

1524
def test_pyproject_dependencies():
1625
pyproject = pathlib.Path(__file__).parent.parent.joinpath('pyproject.toml')

0 commit comments

Comments
 (0)