@@ -727,14 +727,14 @@ def __init__(
727727 # set version from meson.build if version is declared as dynamic
728728 if 'version' in self ._metadata .dynamic :
729729 version = self ._meson_version
730- if version == 'undefined' :
730+ if version is None :
731731 raise pyproject_metadata .ConfigurationError (
732732 'Field "version" declared as dynamic but version is not defined in meson.build' )
733733 self ._metadata .version = packaging .version .Version (version )
734734 else :
735735 # if project section is missing, use minimal metdata from meson.build
736736 name , version = self ._meson_name , self ._meson_version
737- if version == 'undefined' :
737+ if version is None :
738738 raise pyproject_metadata .ConfigurationError (
739739 'Section "project" missing in pyproject.toml and version is not defined in meson.build' )
740740 self ._metadata = Metadata (name = name , version = packaging .version .Version (version ))
@@ -848,17 +848,19 @@ def _manifest(self) -> DefaultDict[str, List[Tuple[pathlib.Path, str]]]:
848848
849849 @property
850850 def _meson_name (self ) -> str :
851- """Name in meson.build."""
852- name = self ._info ('intro-projectinfo' )['descriptive_name' ]
853- assert isinstance (name , str )
854- return name
851+ """The project name specified with ``project()`` in meson.build."""
852+ value = self ._info ('intro-projectinfo' )['descriptive_name' ]
853+ assert isinstance (value , str )
854+ return value
855855
856856 @property
857- def _meson_version (self ) -> str :
858- """Version in meson.build."""
859- name = self ._info ('intro-projectinfo' )['version' ]
860- assert isinstance (name , str )
861- return name
857+ def _meson_version (self ) -> Optional [str ]:
858+ """The version specified with the ``version`` argument to ``project()`` in meson.build."""
859+ value = self ._info ('intro-projectinfo' )['version' ]
860+ assert isinstance (value , str )
861+ if value == 'undefined' :
862+ return None
863+ return value
862864
863865 def sdist (self , directory : Path ) -> pathlib .Path :
864866 """Generates a sdist (source distribution) in the specified directory."""
0 commit comments