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

force recreation of venv if it is not sane (#286) #1797

Merged
merged 4 commits into from
Jan 9, 2020
Merged
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
10 changes: 10 additions & 0 deletions poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ def create_venv(

cwd = self._poetry.file.parent
env = self.get(reload=True)

if not env.is_sane():
force = True

if env.is_venv() and not force:
# Already inside a virtualenv.
return env
Expand Down Expand Up @@ -606,6 +610,12 @@ def create_venv(
self.build_venv(str(venv), executable=executable)
else:
if force:
if not env.is_sane():
io.write_line(
"<warning>The virtual environment found in {} seems to be broken.</warning>".format(
env.path
)
)
io.write_line(
"Recreating virtualenv <c1>{}</> in {}".format(name, str(venv))
)
Expand Down