Skip to content

Commit

Permalink
Fix legacy repositories information not being set on packages (#2484)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater authored Jun 5, 2020
1 parent 9cd16a9 commit 0d646e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions poetry/repositories/legacy_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ def find_packages(

for version in versions:
package = Package(name, version)
package.source_type = "legacy"
package.source_reference = self.name
package.source_url = self._url

if extras is not None:
Expand Down Expand Up @@ -313,6 +315,7 @@ def package(
if release_info["requires_python"]:
package.python_versions = release_info["requires_python"]

package.source_type = "legacy"
package.source_url = self._url
package.source_reference = self.name

Expand Down
7 changes: 7 additions & 0 deletions tests/repositories/test_legacy_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def test_get_package_information_fallback_read_setup():

package = repo.package("jupyter", "1.0.0")

assert package.source_type == "legacy"
assert package.source_reference == repo.name
assert package.source_url == repo.url
assert package.name == "jupyter"
assert package.version.text == "1.0.0"
assert (
Expand Down Expand Up @@ -142,6 +145,10 @@ def test_find_packages_no_prereleases():

assert len(packages) == 1

assert packages[0].source_type == "legacy"
assert packages[0].source_reference == repo.name
assert packages[0].source_url == repo.url


def test_get_package_information_chooses_correct_distribution():
repo = MockRepository()
Expand Down

0 comments on commit 0d646e2

Please sign in to comment.