@@ -215,13 +215,11 @@ class _WheelBuilder():
215
215
def __init__ (
216
216
self ,
217
217
project : Project ,
218
- metadata : Optional [pyproject_metadata .StandardMetadata ],
219
218
source_dir : pathlib .Path ,
220
219
build_dir : pathlib .Path ,
221
220
sources : Dict [str , Dict [str , Any ]],
222
221
) -> None :
223
222
self ._project = project
224
- self ._metadata = metadata
225
223
self ._source_dir = source_dir
226
224
self ._build_dir = build_dir
227
225
self ._sources = sources
@@ -312,13 +310,13 @@ def wheel(self) -> bytes:
312
310
@property
313
311
def entrypoints_txt (self ) -> bytes :
314
312
"""dist-info entry_points.txt."""
315
- if not self ._metadata :
313
+ if not self ._project . metadata :
316
314
return b''
317
315
318
- data = self ._metadata .entrypoints .copy ()
316
+ data = self ._project . metadata .entrypoints .copy ()
319
317
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 ,
322
320
})
323
321
324
322
text = ''
@@ -472,7 +470,7 @@ def _install_path(
472
470
473
471
def _wheel_write_metadata (self , whl : mesonpy ._wheelfile .WheelFile ) -> None :
474
472
# 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 ()) )
476
474
whl .writestr (f'{ self .distinfo_dir } /WHEEL' , self .wheel )
477
475
if self .entrypoints_txt :
478
476
whl .writestr (f'{ self .distinfo_dir } /entry_points.txt' , self .entrypoints_txt )
@@ -789,7 +787,6 @@ def _validate_metadata(self) -> None:
789
787
def _wheel_builder (self ) -> _WheelBuilder :
790
788
return _WheelBuilder (
791
789
self ,
792
- self ._metadata ,
793
790
self ._source_dir ,
794
791
self ._build_dir ,
795
792
self ._install_plan ,
@@ -884,10 +881,10 @@ def version(self) -> str:
884
881
"""Project version."""
885
882
return str (self ._metadata .version )
886
883
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
891
888
892
889
@property
893
890
def license_file (self ) -> Optional [pathlib .Path ]:
@@ -957,8 +954,9 @@ def sdist(self, directory: Path) -> pathlib.Path:
957
954
pkginfo_info = tarfile .TarInfo (f'{ dist_name } /PKG-INFO' )
958
955
if mtime :
959
956
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 ))
962
960
963
961
return sdist
964
962
0 commit comments