Skip to content

Commit

Permalink
Fix wheel data section to use normalised package name, and test (#532)
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Taylor <[email protected]>
  • Loading branch information
robtaylor and robtaylor authored Dec 31, 2022
1 parent 8718681 commit 5a273c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/poetry/core/masonry/builders/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ def dist_info(self) -> str:

@property
def wheel_data_folder(self) -> str:
return f"{self._package.name}-{self._meta.version}.data"
name = distribution_name(self._package.name)
return f"{name}-{self._meta.version}.data"

@property
def wheel_filename(self) -> str:
Expand Down
6 changes: 3 additions & 3 deletions tests/masonry/builders/test_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ def test_complete() -> None:

try:
assert "my_package/sub_pgk1/extra_file.xml" not in zip.namelist()
assert "my-package-1.2.3.data/scripts/script.sh" in zip.namelist()
assert "my_package-1.2.3.data/scripts/script.sh" in zip.namelist()
assert (
"Hello World"
in zip.read("my-package-1.2.3.data/scripts/script.sh").decode()
in zip.read("my_package-1.2.3.data/scripts/script.sh").decode()
)

entry_points = zip.read("my_package-1.2.3.dist-info/entry_points.txt")
Expand Down Expand Up @@ -342,7 +342,7 @@ def test_complete_no_vcs() -> None:
"my_package/sub_pkg1/__init__.py",
"my_package/sub_pkg2/__init__.py",
"my_package/sub_pkg2/data2/data.json",
"my-package-1.2.3.data/scripts/script.sh",
"my_package-1.2.3.data/scripts/script.sh",
"my_package/sub_pkg3/foo.py",
"my_package-1.2.3.dist-info/entry_points.txt",
"my_package-1.2.3.dist-info/LICENSE",
Expand Down

0 comments on commit 5a273c3

Please sign in to comment.