Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not print unwanted operations on --lock #7915

Merged
merged 2 commits into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def updates_count(self) -> int:
def removals_count(self) -> int:
return self._executed["uninstall"]

@property
def enabled(self) -> bool:
return self._enabled

def supports_fancy_output(self) -> bool:
return self._io.output.is_decorated() and not self._dry_run

Expand Down
6 changes: 2 additions & 4 deletions src/poetry/installation/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def __init__(
self._requires_synchronization = False
self._update = False
self._verbose = False
self._write_lock = True
radoering marked this conversation as resolved.
Show resolved Hide resolved
self._groups: Iterable[str] | None = None
self._skip_directory = False
self._lock = False
Expand Down Expand Up @@ -99,7 +98,6 @@ def run(self) -> int:

if self.is_dry_run():
self.verbose(True)
self._write_lock = False

return self._do_install()

Expand Down Expand Up @@ -269,7 +267,7 @@ def _do_install(self) -> int:
lockfile_repo = LockfileRepository()
self._populate_lockfile_repo(lockfile_repo, ops)

if self._lock and self._update:
if not self.executor.enabled:
# If we are only in lock mode, no need to go any further
self._write_lock_file(lockfile_repo)
return 0
Expand Down Expand Up @@ -348,7 +346,7 @@ def _do_install(self) -> int:
return status

def _write_lock_file(self, repo: LockfileRepository, force: bool = False) -> None:
if self._write_lock and (force or self._update):
if not self.is_dry_run() and (force or self._update):
updated_lock = self._locker.set_lock_data(self._package, repo.packages)

if updated_lock:
Expand Down