Skip to content

Commit

Permalink
fix: LICENSE files were placed in the wrong place (#325)
Browse files Browse the repository at this point in the history
Yanked 0.4.0. Will release 0.4.1 once this goes in.

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii authored May 19, 2023
1 parent 2f808b7 commit f280ebc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## Version 0.4.1

A fix for LICENCE files being placed in the wrong place in the wheel. Now we
follow hatchling's structure of placing them in `*.dist-info/licenses`.

Fixes:

- LICENCE files were placed in the wrong place by @henryiii in #325

## Version 0.4.0

An important fix/feature: LICENSE files were not being included in the wheel's
Expand Down
4 changes: 3 additions & 1 deletion src/scikit_build_core/build/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ def _build_wheel_impl(
with WheelWriter(metadata, Path(wheel_directory), tags.as_tags_set()) as wheel:
wheel.build(wheel_dirs)
for license_file in license_files:
wheel.write(str(license_file), license_file.name)
wheel.write(
str(license_file), f"{wheel.dist_info}/licenses/{license_file.name}"
)

if editable:
modules = {
Expand Down
8 changes: 4 additions & 4 deletions tests/test_pyproject_pep517.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ def test_pep517_wheel(virtualenv):
entry_points = p.joinpath(
"cmake_example-0.0.1.dist-info/entry_points.txt"
).read_text()
assert p.joinpath("cmake_example-0.0.1.dist-info/licenses/LICENSE").exists()

assert len(file_names) == 3
assert len(file_names) == 2
assert "cmake_example-0.0.1.dist-info" in file_names
file_names.remove("cmake_example-0.0.1.dist-info")
file_names.remove("LICENSE")
(so_file,) = file_names

assert so_file.startswith("cmake_example")
Expand Down Expand Up @@ -208,11 +208,11 @@ def test_pep517_wheel_source_dir(virtualenv):
entry_points = p.joinpath(
"cmake_example-0.0.1.dist-info/entry_points.txt"
).read_text()
assert p.joinpath("cmake_example-0.0.1.dist-info/licenses/LICENSE").exists()

assert len(file_names) == 3
assert len(file_names) == 2
assert "cmake_example-0.0.1.dist-info" in file_names
file_names.remove("cmake_example-0.0.1.dist-info")
file_names.remove("LICENSE")
(so_file,) = file_names

assert so_file.startswith("cmake_example")
Expand Down
8 changes: 4 additions & 4 deletions tests/test_pyproject_pep518.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def test_pep518_wheel(isolated, build_args):
with wheel.open("rb") as f:
p = zipfile.Path(f)
file_names = [p.name for p in p.iterdir()]
assert p.joinpath("cmake_example-0.0.1.dist-info/licenses/LICENSE").exists()

assert len(file_names) == 3
assert len(file_names) == 2
assert "cmake_example-0.0.1.dist-info" in file_names
file_names.remove("cmake_example-0.0.1.dist-info")
file_names.remove("LICENSE")
(so_file,) = file_names

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

assert len(file_names) == 3
assert len(file_names) == 2
assert "cmake_example-0.0.1.dist-info" in file_names
file_names.remove("cmake_example-0.0.1.dist-info")
file_names.remove("LICENSE")
(so_file,) = file_names

assert so_file.startswith("cmake_example")
Expand Down

0 comments on commit f280ebc

Please sign in to comment.