@@ -184,16 +184,23 @@ def test_build_sdist(monkeypatch, tmpdir):
184
184
)
185
185
186
186
(sdist ,) = tmpdir .visit ("*.tar.gz" )
187
+ version = sdist .basename .split ("-" )[1 ][:- 7 ]
187
188
188
189
with tarfile .open (str (sdist ), "r:gz" ) as tar :
189
190
simpler = {n .split ("/" , 1 )[- 1 ] for n in tar .getnames ()[1 :]}
191
+ (pkg_info_path ,) = (n for n in simpler if n .endswith ("PKG-INFO" ))
190
192
191
193
pyproject_toml = read_tz_file (tar , "pyproject.toml" )
194
+ pkg_info = read_tz_file (tar , pkg_info_path ).decode ("utf-8" )
192
195
193
196
files = headers | sdist_files
194
197
assert files <= simpler
195
198
196
199
assert b'name = "pybind11"' in pyproject_toml
200
+ assert "License-Expression: BSD-3-Clause" in pkg_info
201
+ assert "License-File: LICENSE" in pkg_info
202
+ assert "Provides-Extra: global" in pkg_info
203
+ assert f'Requires-Dist: pybind11-global=={ version } ; extra == "global"' in pkg_info
197
204
198
205
199
206
def test_build_global_dist (monkeypatch , tmpdir ):
@@ -216,13 +223,19 @@ def test_build_global_dist(monkeypatch, tmpdir):
216
223
217
224
with tarfile .open (str (sdist ), "r:gz" ) as tar :
218
225
simpler = {n .split ("/" , 1 )[- 1 ] for n in tar .getnames ()[1 :]}
226
+ (pkg_info_path ,) = (n for n in simpler if n .endswith ("PKG-INFO" ))
219
227
220
228
pyproject_toml = read_tz_file (tar , "pyproject.toml" )
229
+ pkg_info = read_tz_file (tar , pkg_info_path ).decode ("utf-8" )
221
230
222
231
files = headers | sdist_files
223
232
assert files <= simpler
224
233
225
234
assert b'name = "pybind11-global"' in pyproject_toml
235
+ assert "License-Expression: BSD-3-Clause" in pkg_info
236
+ assert "License-File: LICENSE" in pkg_info
237
+ assert "Provides-Extra: global" not in pkg_info
238
+ assert 'Requires-Dist: pybind11-global; extra == "global"' not in pkg_info
226
239
227
240
228
241
def tests_build_wheel (monkeypatch , tmpdir ):
@@ -251,6 +264,8 @@ def tests_build_wheel(monkeypatch, tmpdir):
251
264
cmakeconfig = (share / "cmake/pybind11/pybind11Config.cmake" ).read_text (
252
265
encoding = "utf-8"
253
266
)
267
+ (pkg_info_path ,) = (n for n in names if n .endswith ("METADATA" ))
268
+ pkg_info = zipfile .Path (z , pkg_info_path ).read_text (encoding = "utf-8" )
254
269
255
270
trimmed = {n for n in names if "dist-info" not in n }
256
271
trimmed |= {f"dist-info/{ n .split ('/' , 1 )[- 1 ]} " for n in names if "dist-info" in n }
@@ -264,6 +279,11 @@ def tests_build_wheel(monkeypatch, tmpdir):
264
279
pkgconfig_expected = PKGCONFIG .format (VERSION = simple_version )
265
280
assert pkgconfig_expected == pkgconfig
266
281
282
+ assert "License-Expression: BSD-3-Clause" in pkg_info
283
+ assert "License-File: LICENSE" in pkg_info
284
+ assert "Provides-Extra: global" in pkg_info
285
+ assert f'Requires-Dist: pybind11-global=={ version } ; extra == "global"' in pkg_info
286
+
267
287
268
288
def tests_build_global_wheel (monkeypatch , tmpdir ):
269
289
monkeypatch .chdir (MAIN_DIR )
@@ -303,6 +323,14 @@ def tests_build_global_wheel(monkeypatch, tmpdir):
303
323
encoding = "utf-8"
304
324
)
305
325
326
+ (pkg_info_path ,) = (n for n in names if n .endswith ("METADATA" ))
327
+ pkg_info = zipfile .Path (z , pkg_info_path ).read_text (encoding = "utf-8" )
328
+
329
+ assert "License-Expression: BSD-3-Clause" in pkg_info
330
+ assert "License-File: LICENSE" in pkg_info
331
+ assert "Provides-Extra: global" not in pkg_info
332
+ assert 'Requires-Dist: pybind11-global; extra == "global"' not in pkg_info
333
+
306
334
trimmed = {n [len (beginning ) + 1 :] for n in names }
307
335
308
336
assert files == trimmed
0 commit comments