@@ -192,15 +192,13 @@ class _WheelBuilder():
192
192
def __init__ (
193
193
self ,
194
194
project : Project ,
195
- metadata : Optional [pyproject_metadata .StandardMetadata ],
196
195
source_dir : pathlib .Path ,
197
196
install_dir : pathlib .Path ,
198
197
build_dir : pathlib .Path ,
199
198
sources : Dict [str , Dict [str , Any ]],
200
199
copy_files : Dict [str , str ],
201
200
) -> None :
202
201
self ._project = project
203
- self ._metadata = metadata
204
202
self ._source_dir = source_dir
205
203
self ._install_dir = install_dir
206
204
self ._build_dir = build_dir
@@ -293,13 +291,13 @@ def wheel(self) -> bytes:
293
291
@property
294
292
def entrypoints_txt (self ) -> bytes :
295
293
"""dist-info entry_points.txt."""
296
- if not self ._metadata :
294
+ if not self ._project . metadata :
297
295
return b''
298
296
299
- data = self ._metadata .entrypoints .copy ()
297
+ data = self ._project . metadata .entrypoints .copy ()
300
298
data .update ({
301
- 'console_scripts' : self ._metadata .scripts ,
302
- 'gui_scripts' : self ._metadata .gui_scripts ,
299
+ 'console_scripts' : self ._project . metadata .scripts ,
300
+ 'gui_scripts' : self ._project . metadata .gui_scripts ,
303
301
})
304
302
305
303
text = ''
@@ -553,7 +551,7 @@ def _install_path(
553
551
554
552
def _wheel_write_metadata (self , whl : mesonpy ._wheelfile .WheelFile ) -> None :
555
553
# add metadata
556
- whl .writestr (f'{ self .distinfo_dir } /METADATA' , self ._project .metadata )
554
+ whl .writestr (f'{ self .distinfo_dir } /METADATA' , bytes ( self ._project .metadata . as_rfc822 ()) )
557
555
whl .writestr (f'{ self .distinfo_dir } /WHEEL' , self .wheel )
558
556
if self .entrypoints_txt :
559
557
whl .writestr (f'{ self .distinfo_dir } /entry_points.txt' , self .entrypoints_txt )
@@ -894,7 +892,6 @@ def _validate_metadata(self) -> None:
894
892
def _wheel_builder (self ) -> _WheelBuilder :
895
893
return _WheelBuilder (
896
894
self ,
897
- self ._metadata ,
898
895
self ._source_dir ,
899
896
self ._install_dir ,
900
897
self ._build_dir ,
@@ -1002,10 +999,10 @@ def version(self) -> str:
1002
999
"""Project version."""
1003
1000
return str (self ._metadata .version )
1004
1001
1005
- @cached_property
1006
- def metadata (self ) -> bytes :
1007
- """Project metadata as an RFC822 message ."""
1008
- return bytes ( self ._metadata . as_rfc822 ())
1002
+ @property
1003
+ def metadata (self ) -> pyproject_metadata . StandardMetadata :
1004
+ """Project metadata."""
1005
+ return self ._metadata
1009
1006
1010
1007
@property
1011
1008
def license_file (self ) -> Optional [pathlib .Path ]:
@@ -1075,8 +1072,9 @@ def sdist(self, directory: Path) -> pathlib.Path:
1075
1072
pkginfo_info = tarfile .TarInfo (f'{ dist_name } /PKG-INFO' )
1076
1073
if mtime :
1077
1074
pkginfo_info .mtime = mtime
1078
- pkginfo_info .size = len (self .metadata )
1079
- tar .addfile (pkginfo_info , fileobj = io .BytesIO (self .metadata ))
1075
+ metadata = bytes (self ._metadata .as_rfc822 ())
1076
+ pkginfo_info .size = len (metadata )
1077
+ tar .addfile (pkginfo_info , fileobj = io .BytesIO (metadata ))
1080
1078
1081
1079
return sdist
1082
1080
0 commit comments