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(utils.env): import cli_run from virtualenv #2096

Merged
merged 2 commits into from
Feb 28, 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
29 changes: 19 additions & 10 deletions poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,19 @@
from venv import EnvBuilder

builder = EnvBuilder(with_pip=True)
build = builder.create
builder.create(path)
except ImportError:
# We fallback on virtualenv for Python 2.7
from virtualenv import create_environment
try:
# We fallback on virtualenv for Python 2.7
from virtualenv import create_environment

build = create_environment
create_environment(path)
except ImportError:
# since virtualenv>20 we have to use cli_run
from virtualenv import cli_run

build(path)"""
cli_run([path])
"""


class EnvError(Exception):
Expand Down Expand Up @@ -668,14 +673,18 @@ def build_venv(cls, path, executable=None):
use_symlinks = True

builder = EnvBuilder(with_pip=True, symlinks=use_symlinks)
build = builder.create
builder.create(path)
except ImportError:
# We fallback on virtualenv for Python 2.7
from virtualenv import create_environment
try:
# We fallback on virtualenv for Python 2.7
from virtualenv import create_environment

build = create_environment
create_environment(path)
except ImportError:
# since virtualenv>20 we have to use cli_run
from virtualenv import cli_run

build(path)
cli_run([path])

def remove_venv(self, path): # type: (str) -> None
shutil.rmtree(path)
Expand Down