Skip to content

Commit f280ebc

Browse files
authored
fix: LICENSE files were placed in the wrong place (#325)
Yanked 0.4.0. Will release 0.4.1 once this goes in. --------- Signed-off-by: Henry Schreiner <[email protected]>
1 parent 2f808b7 commit f280ebc

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

docs/changelog.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## Version 0.4.1
4+
5+
A fix for LICENCE files being placed in the wrong place in the wheel. Now we
6+
follow hatchling's structure of placing them in `*.dist-info/licenses`.
7+
8+
Fixes:
9+
10+
- LICENCE files were placed in the wrong place by @henryiii in #325
11+
312
## Version 0.4.0
413

514
An important fix/feature: LICENSE files were not being included in the wheel's

src/scikit_build_core/build/wheel.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,9 @@ def _build_wheel_impl(
228228
with WheelWriter(metadata, Path(wheel_directory), tags.as_tags_set()) as wheel:
229229
wheel.build(wheel_dirs)
230230
for license_file in license_files:
231-
wheel.write(str(license_file), license_file.name)
231+
wheel.write(
232+
str(license_file), f"{wheel.dist_info}/licenses/{license_file.name}"
233+
)
232234

233235
if editable:
234236
modules = {

tests/test_pyproject_pep517.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ def test_pep517_wheel(virtualenv):
160160
entry_points = p.joinpath(
161161
"cmake_example-0.0.1.dist-info/entry_points.txt"
162162
).read_text()
163+
assert p.joinpath("cmake_example-0.0.1.dist-info/licenses/LICENSE").exists()
163164

164-
assert len(file_names) == 3
165+
assert len(file_names) == 2
165166
assert "cmake_example-0.0.1.dist-info" in file_names
166167
file_names.remove("cmake_example-0.0.1.dist-info")
167-
file_names.remove("LICENSE")
168168
(so_file,) = file_names
169169

170170
assert so_file.startswith("cmake_example")
@@ -208,11 +208,11 @@ def test_pep517_wheel_source_dir(virtualenv):
208208
entry_points = p.joinpath(
209209
"cmake_example-0.0.1.dist-info/entry_points.txt"
210210
).read_text()
211+
assert p.joinpath("cmake_example-0.0.1.dist-info/licenses/LICENSE").exists()
211212

212-
assert len(file_names) == 3
213+
assert len(file_names) == 2
213214
assert "cmake_example-0.0.1.dist-info" in file_names
214215
file_names.remove("cmake_example-0.0.1.dist-info")
215-
file_names.remove("LICENSE")
216216
(so_file,) = file_names
217217

218218
assert so_file.startswith("cmake_example")

tests/test_pyproject_pep518.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ def test_pep518_wheel(isolated, build_args):
7070
with wheel.open("rb") as f:
7171
p = zipfile.Path(f)
7272
file_names = [p.name for p in p.iterdir()]
73+
assert p.joinpath("cmake_example-0.0.1.dist-info/licenses/LICENSE").exists()
7374

74-
assert len(file_names) == 3
75+
assert len(file_names) == 2
7576
assert "cmake_example-0.0.1.dist-info" in file_names
7677
file_names.remove("cmake_example-0.0.1.dist-info")
77-
file_names.remove("LICENSE")
7878
(so_file,) = file_names
7979

8080
assert so_file.startswith("cmake_example")
@@ -119,11 +119,11 @@ def test_pep518_rebuild_build_dir(isolated, tmp_path, build_args):
119119
with wheel.open("rb") as f:
120120
p = zipfile.Path(f)
121121
file_names = [p.name for p in p.iterdir()]
122+
assert p.joinpath("cmake_example-0.0.1.dist-info/licenses/LICENSE").exists()
122123

123-
assert len(file_names) == 3
124+
assert len(file_names) == 2
124125
assert "cmake_example-0.0.1.dist-info" in file_names
125126
file_names.remove("cmake_example-0.0.1.dist-info")
126-
file_names.remove("LICENSE")
127127
(so_file,) = file_names
128128

129129
assert so_file.startswith("cmake_example")

0 commit comments

Comments
 (0)