Skip to content

Commit

Permalink
locker: locked_repository should be a LockfileRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Sep 23, 2022
1 parent c275878 commit be3d184
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/poetry/packages/locker.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from tomlkit.items import Table
from tomlkit.toml_document import TOMLDocument

from poetry.repositories import Repository
from poetry.repositories.lockfile_repository import LockfileRepository

logger = logging.getLogger(__name__)
_GENERATED_IDENTIFIER = "@" + "generated"
Expand Down Expand Up @@ -91,22 +91,23 @@ def is_fresh(self) -> bool:

return False

def locked_repository(self) -> Repository:
def locked_repository(self) -> LockfileRepository:
"""
Searches and returns a repository of locked packages.
"""
from poetry.factory import Factory
from poetry.repositories import Repository
from poetry.repositories.lockfile_repository import LockfileRepository

repository = LockfileRepository()

if not self.is_locked():
return Repository("poetry-locked")
return repository

lock_data = self.lock_data
packages = Repository("poetry-locked")
locked_packages = cast("list[dict[str, Any]]", lock_data["package"])

if not locked_packages:
return packages
return repository

for info in locked_packages:
source = info.get("source", {})
Expand Down Expand Up @@ -208,9 +209,9 @@ def locked_repository(self) -> Repository:
if "develop" in info:
package.develop = info["develop"]

packages.add_package(package)
repository.add_package(package)

return packages
return repository

def set_lock_data(self, root: Package, packages: list[Package]) -> bool:
files: dict[str, Any] = table()
Expand Down

0 comments on commit be3d184

Please sign in to comment.