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 #3139 #4448

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
7 changes: 7 additions & 0 deletions poetry/installation/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def __init__(
self._verbose = False
self._write_lock = True
self._dev_mode = True
self._create_virtualenv = config.get("virtualenvs.create")
self._execute_operations = True
self._lock = False

Expand Down Expand Up @@ -512,6 +513,12 @@ def _filter_operations(
package = op.package

if op.job_type == "uninstall":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's DRY this up a bit. Something like:

if not self._create_virtualenv and isinstance(op, (Update, Uninstall)):
    op.skip(f"Virtualenv creation disabled (during {op.job_type})")
    continue

if not self._create_virtualenv:
op.skip("Not uninstalling because: virtualenvs.create==False")
continue

if isinstance(op, Update) and not self._create_virtualenv:
op.skip("Not updating because: virtualenvs.create==False")
continue

if not self._env.is_valid_for_marker(package.marker):
Expand Down