@@ -219,13 +219,11 @@ class _WheelBuilder():
219219 def __init__ (
220220 self ,
221221 project : Project ,
222- metadata : Optional [pyproject_metadata .StandardMetadata ],
223222 source_dir : pathlib .Path ,
224223 build_dir : pathlib .Path ,
225224 sources : Dict [str , Dict [str , Any ]],
226225 ) -> None :
227226 self ._project = project
228- self ._metadata = metadata
229227 self ._source_dir = source_dir
230228 self ._build_dir = build_dir
231229 self ._sources = sources
@@ -316,13 +314,13 @@ def wheel(self) -> bytes:
316314 @property
317315 def entrypoints_txt (self ) -> bytes :
318316 """dist-info entry_points.txt."""
319- if not self ._metadata :
317+ if not self ._project . metadata :
320318 return b''
321319
322- data = self ._metadata .entrypoints .copy ()
320+ data = self ._project . metadata .entrypoints .copy ()
323321 data .update ({
324- 'console_scripts' : self ._metadata .scripts ,
325- 'gui_scripts' : self ._metadata .gui_scripts ,
322+ 'console_scripts' : self ._project . metadata .scripts ,
323+ 'gui_scripts' : self ._project . metadata .gui_scripts ,
326324 })
327325
328326 text = ''
@@ -475,7 +473,7 @@ def _install_path(
475473
476474 def _wheel_write_metadata (self , whl : mesonpy ._wheelfile .WheelFile ) -> None :
477475 # add metadata
478- whl .writestr (f'{ self .distinfo_dir } /METADATA' , self ._project .metadata )
476+ whl .writestr (f'{ self .distinfo_dir } /METADATA' , bytes ( self ._project .metadata . as_rfc822 ()) )
479477 whl .writestr (f'{ self .distinfo_dir } /WHEEL' , self .wheel )
480478 if self .entrypoints_txt :
481479 whl .writestr (f'{ self .distinfo_dir } /entry_points.txt' , self .entrypoints_txt )
@@ -792,7 +790,6 @@ def _validate_metadata(self) -> None:
792790 def _wheel_builder (self ) -> _WheelBuilder :
793791 return _WheelBuilder (
794792 self ,
795- self ._metadata ,
796793 self ._source_dir ,
797794 self ._build_dir ,
798795 self ._install_plan ,
@@ -887,10 +884,10 @@ def version(self) -> str:
887884 """Project version."""
888885 return str (self ._metadata .version )
889886
890- @cached_property
891- def metadata (self ) -> bytes :
892- """Project metadata as an RFC822 message ."""
893- return bytes ( self ._metadata . as_rfc822 ())
887+ @property
888+ def metadata (self ) -> pyproject_metadata . StandardMetadata :
889+ """Project metadata."""
890+ return self ._metadata
894891
895892 @property
896893 def license_file (self ) -> Optional [pathlib .Path ]:
@@ -960,8 +957,9 @@ def sdist(self, directory: Path) -> pathlib.Path:
960957 pkginfo_info = tarfile .TarInfo (f'{ dist_name } /PKG-INFO' )
961958 if mtime :
962959 pkginfo_info .mtime = mtime
963- pkginfo_info .size = len (self .metadata )
964- tar .addfile (pkginfo_info , fileobj = io .BytesIO (self .metadata ))
960+ metadata = bytes (self ._metadata .as_rfc822 ())
961+ pkginfo_info .size = len (metadata )
962+ tar .addfile (pkginfo_info , fileobj = io .BytesIO (metadata ))
965963
966964 return sdist
967965
0 commit comments