@@ -750,14 +750,14 @@ def __init__(
750750 # set version from meson.build if version is declared as dynamic
751751 if 'version' in self ._metadata .dynamic :
752752 version = self ._meson_version
753- if version == 'undefined' :
753+ if version is None :
754754 raise pyproject_metadata .ConfigurationError (
755755 'Field "version" declared as dynamic but version is not defined in meson.build' )
756756 self ._metadata .version = packaging .version .Version (version )
757757 else :
758758 # if project section is missing, use minimal metdata from meson.build
759759 name , version = self ._meson_name , self ._meson_version
760- if version == 'undefined' :
760+ if version is None :
761761 raise pyproject_metadata .ConfigurationError (
762762 'Section "project" missing in pyproject.toml and version is not defined in meson.build' )
763763 self ._metadata = Metadata (name = name , version = packaging .version .Version (version ))
@@ -871,17 +871,19 @@ def _manifest(self) -> DefaultDict[str, List[Tuple[pathlib.Path, str]]]:
871871
872872 @property
873873 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
878878
879879 @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
885887
886888 def sdist (self , directory : Path ) -> pathlib .Path :
887889 """Generates a sdist (source distribution) in the specified directory."""
0 commit comments