@@ -724,14 +724,14 @@ def __init__(
724724 # set version from meson.build if version is declared as dynamic
725725 if 'version' in self ._metadata .dynamic :
726726 version = self ._meson_version
727- if version == 'undefined' :
727+ if version is None :
728728 raise pyproject_metadata .ConfigurationError (
729729 'Field "version" declared as dynamic but version is not defined in meson.build' )
730730 self ._metadata .version = packaging .version .Version (version )
731731 else :
732732 # if project section is missing, use minimal metdata from meson.build
733733 name , version = self ._meson_name , self ._meson_version
734- if version == 'undefined' :
734+ if version is None :
735735 raise pyproject_metadata .ConfigurationError (
736736 'Section "project" missing in pyproject.toml and version is not defined in meson.build' )
737737 self ._metadata = Metadata (name = name , version = packaging .version .Version (version ))
@@ -845,17 +845,19 @@ def _manifest(self) -> DefaultDict[str, List[Tuple[pathlib.Path, str]]]:
845845
846846 @property
847847 def _meson_name (self ) -> str :
848- """Name in meson.build."""
849- name = self ._info ('intro-projectinfo' )['descriptive_name' ]
850- assert isinstance (name , str )
851- return name
848+ """The project name specified with ``project()`` in meson.build."""
849+ value = self ._info ('intro-projectinfo' )['descriptive_name' ]
850+ assert isinstance (value , str )
851+ return value
852852
853853 @property
854- def _meson_version (self ) -> str :
855- """Version in meson.build."""
856- name = self ._info ('intro-projectinfo' )['version' ]
857- assert isinstance (name , str )
858- return name
854+ def _meson_version (self ) -> Optional [str ]:
855+ """The version specified with the ``version`` argument to ``project()`` in meson.build."""
856+ value = self ._info ('intro-projectinfo' )['version' ]
857+ assert isinstance (value , str )
858+ if value == 'undefined' :
859+ return None
860+ return value
859861
860862 def sdist (self , directory : Path ) -> pathlib .Path :
861863 """Generates a sdist (source distribution) in the specified directory."""
0 commit comments