Skip to content

Commit

Permalink
fix package info for sdist
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored and radoering committed Nov 19, 2023
1 parent 05f5f6c commit 791dfed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/poetry/inspection/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ def _from_sdist_file(cls, path: Path) -> PackageInfo:

# now this is an unpacked directory we know how to deal with
new_info = cls.from_directory(path=sdist_dir)
new_info._source_type = "file"
new_info._source_url = path.resolve().as_posix()

if not info:
return new_info
Expand Down
Binary file not shown.
14 changes: 14 additions & 0 deletions tests/inspection/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,30 @@ def demo_check_info(info: PackageInfo, requires_dist: set[str] | None = None) ->
def test_info_from_sdist(demo_sdist: Path) -> None:
info = PackageInfo.from_sdist(demo_sdist)
demo_check_info(info)
assert info._source_type == "file"
assert info._source_url == demo_sdist.resolve().as_posix()


def test_info_from_sdist_no_pkg_info(fixture_dir: FixtureDirGetter) -> None:
path = fixture_dir("distributions") / "demo_no_pkg_info-0.1.0.tar.gz"
info = PackageInfo.from_sdist(path)
demo_check_info(info)
assert info._source_type == "file"
assert info._source_url == path.resolve().as_posix()


def test_info_from_wheel(demo_wheel: Path) -> None:
info = PackageInfo.from_wheel(demo_wheel)
demo_check_info(info)
assert info._source_type == "file"
assert info._source_url == demo_wheel.resolve().as_posix()


def test_info_from_bdist(demo_wheel: Path) -> None:
info = PackageInfo.from_bdist(demo_wheel)
demo_check_info(info)
assert info._source_type == "file"
assert info._source_url == demo_wheel.resolve().as_posix()


def test_info_from_poetry_directory(fixture_dir: FixtureDirGetter) -> None:
Expand Down

0 comments on commit 791dfed

Please sign in to comment.