@@ -750,14 +750,14 @@ def __init__(
750
750
# set version from meson.build if version is declared as dynamic
751
751
if 'version' in self ._metadata .dynamic :
752
752
version = self ._meson_version
753
- if version == 'undefined' :
753
+ if version is None :
754
754
raise pyproject_metadata .ConfigurationError (
755
755
'Field "version" declared as dynamic but version is not defined in meson.build' )
756
756
self ._metadata .version = packaging .version .Version (version )
757
757
else :
758
758
# if project section is missing, use minimal metdata from meson.build
759
759
name , version = self ._meson_name , self ._meson_version
760
- if version == 'undefined' :
760
+ if version is None :
761
761
raise pyproject_metadata .ConfigurationError (
762
762
'Section "project" missing in pyproject.toml and version is not defined in meson.build' )
763
763
self ._metadata = Metadata (name = name , version = packaging .version .Version (version ))
@@ -871,17 +871,19 @@ def _manifest(self) -> DefaultDict[str, List[Tuple[pathlib.Path, str]]]:
871
871
872
872
@property
873
873
def _meson_name (self ) -> str :
874
- """Name in meson.build."""
875
- name = self ._info ('intro-projectinfo' )['descriptive_name' ]
876
- assert isinstance (name , str )
877
- return name
874
+ """The project name specified with ``project()`` in meson.build."""
875
+ value = self ._info ('intro-projectinfo' )['descriptive_name' ]
876
+ assert isinstance (value , str )
877
+ return value
878
878
879
879
@property
880
- def _meson_version (self ) -> str :
881
- """Version in meson.build."""
882
- name = self ._info ('intro-projectinfo' )['version' ]
883
- assert isinstance (name , str )
884
- return name
880
+ def _meson_version (self ) -> Optional [str ]:
881
+ """The version specified with the ``version`` argument to ``project()`` in meson.build."""
882
+ value = self ._info ('intro-projectinfo' )['version' ]
883
+ assert isinstance (value , str )
884
+ if value == 'undefined' :
885
+ return None
886
+ return value
885
887
886
888
def sdist (self , directory : Path ) -> pathlib .Path :
887
889
"""Generates a sdist (source distribution) in the specified directory."""
0 commit comments