@@ -215,13 +215,11 @@ class _WheelBuilder():
215215 def __init__ (
216216 self ,
217217 project : Project ,
218- metadata : Optional [pyproject_metadata .StandardMetadata ],
219218 source_dir : pathlib .Path ,
220219 build_dir : pathlib .Path ,
221220 sources : Dict [str , Dict [str , Any ]],
222221 ) -> None :
223222 self ._project = project
224- self ._metadata = metadata
225223 self ._source_dir = source_dir
226224 self ._build_dir = build_dir
227225 self ._sources = sources
@@ -312,13 +310,13 @@ def wheel(self) -> bytes:
312310 @property
313311 def entrypoints_txt (self ) -> bytes :
314312 """dist-info entry_points.txt."""
315- if not self ._metadata :
313+ if not self ._project . metadata :
316314 return b''
317315
318- data = self ._metadata .entrypoints .copy ()
316+ data = self ._project . metadata .entrypoints .copy ()
319317 data .update ({
320- 'console_scripts' : self ._metadata .scripts ,
321- 'gui_scripts' : self ._metadata .gui_scripts ,
318+ 'console_scripts' : self ._project . metadata .scripts ,
319+ 'gui_scripts' : self ._project . metadata .gui_scripts ,
322320 })
323321
324322 text = ''
@@ -472,7 +470,7 @@ def _install_path(
472470
473471 def _wheel_write_metadata (self , whl : mesonpy ._wheelfile .WheelFile ) -> None :
474472 # add metadata
475- whl .writestr (f'{ self .distinfo_dir } /METADATA' , self ._project .metadata )
473+ whl .writestr (f'{ self .distinfo_dir } /METADATA' , bytes ( self ._project .metadata . as_rfc822 ()) )
476474 whl .writestr (f'{ self .distinfo_dir } /WHEEL' , self .wheel )
477475 if self .entrypoints_txt :
478476 whl .writestr (f'{ self .distinfo_dir } /entry_points.txt' , self .entrypoints_txt )
@@ -789,7 +787,6 @@ def _validate_metadata(self) -> None:
789787 def _wheel_builder (self ) -> _WheelBuilder :
790788 return _WheelBuilder (
791789 self ,
792- self ._metadata ,
793790 self ._source_dir ,
794791 self ._build_dir ,
795792 self ._install_plan ,
@@ -884,10 +881,10 @@ def version(self) -> str:
884881 """Project version."""
885882 return str (self ._metadata .version )
886883
887- @cached_property
888- def metadata (self ) -> bytes :
889- """Project metadata as an RFC822 message ."""
890- return bytes ( self ._metadata . as_rfc822 ())
884+ @property
885+ def metadata (self ) -> pyproject_metadata . StandardMetadata :
886+ """Project metadata."""
887+ return self ._metadata
891888
892889 @property
893890 def license_file (self ) -> Optional [pathlib .Path ]:
@@ -957,8 +954,9 @@ def sdist(self, directory: Path) -> pathlib.Path:
957954 pkginfo_info = tarfile .TarInfo (f'{ dist_name } /PKG-INFO' )
958955 if mtime :
959956 pkginfo_info .mtime = mtime
960- pkginfo_info .size = len (self .metadata )
961- tar .addfile (pkginfo_info , fileobj = io .BytesIO (self .metadata ))
957+ metadata = bytes (self ._metadata .as_rfc822 ())
958+ pkginfo_info .size = len (metadata )
959+ tar .addfile (pkginfo_info , fileobj = io .BytesIO (metadata ))
962960
963961 return sdist
964962
0 commit comments