@@ -219,13 +219,11 @@ class _WheelBuilder():
219
219
def __init__ (
220
220
self ,
221
221
project : Project ,
222
- metadata : Optional [pyproject_metadata .StandardMetadata ],
223
222
source_dir : pathlib .Path ,
224
223
build_dir : pathlib .Path ,
225
224
sources : Dict [str , Dict [str , Any ]],
226
225
) -> None :
227
226
self ._project = project
228
- self ._metadata = metadata
229
227
self ._source_dir = source_dir
230
228
self ._build_dir = build_dir
231
229
self ._sources = sources
@@ -316,13 +314,13 @@ def wheel(self) -> bytes:
316
314
@property
317
315
def entrypoints_txt (self ) -> bytes :
318
316
"""dist-info entry_points.txt."""
319
- if not self ._metadata :
317
+ if not self ._project . metadata :
320
318
return b''
321
319
322
- data = self ._metadata .entrypoints .copy ()
320
+ data = self ._project . metadata .entrypoints .copy ()
323
321
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 ,
326
324
})
327
325
328
326
text = ''
@@ -475,7 +473,7 @@ def _install_path(
475
473
476
474
def _wheel_write_metadata (self , whl : mesonpy ._wheelfile .WheelFile ) -> None :
477
475
# 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 ()) )
479
477
whl .writestr (f'{ self .distinfo_dir } /WHEEL' , self .wheel )
480
478
if self .entrypoints_txt :
481
479
whl .writestr (f'{ self .distinfo_dir } /entry_points.txt' , self .entrypoints_txt )
@@ -792,7 +790,6 @@ def _validate_metadata(self) -> None:
792
790
def _wheel_builder (self ) -> _WheelBuilder :
793
791
return _WheelBuilder (
794
792
self ,
795
- self ._metadata ,
796
793
self ._source_dir ,
797
794
self ._build_dir ,
798
795
self ._install_plan ,
@@ -887,10 +884,10 @@ def version(self) -> str:
887
884
"""Project version."""
888
885
return str (self ._metadata .version )
889
886
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
894
891
895
892
@property
896
893
def license_file (self ) -> Optional [pathlib .Path ]:
@@ -960,8 +957,9 @@ def sdist(self, directory: Path) -> pathlib.Path:
960
957
pkginfo_info = tarfile .TarInfo (f'{ dist_name } /PKG-INFO' )
961
958
if mtime :
962
959
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 ))
965
963
966
964
return sdist
967
965
0 commit comments