From 134b4fca4ffa4b58147fe040eaba49b2c98427e3 Mon Sep 17 00:00:00 2001 From: Ciaran Ainsworth Date: Thu, 16 Apr 2020 00:06:41 +0100 Subject: [PATCH 1/3] Fixed process for newer virtualenv --- pip_safe/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pip_safe/__init__.py b/pip_safe/__init__.py index 7345839..0fc1dfa 100644 --- a/pip_safe/__init__.py +++ b/pip_safe/__init__.py @@ -9,7 +9,6 @@ from .utils import symlink, make_sure_path_exists, ensure_file_is_absent, call_subprocess - def confirm_smth(question): reply = str(six.moves.input(question + ' (y/Nn): ')).lower().strip() if reply and reply[0] == 'y': @@ -100,7 +99,15 @@ def install_package(name, system_wide=False): 'Installing {} {} ...'.format(name, install_for) ) log.debug('Creating virtualenv at {}'.format(venv_dir)) - virtualenv.create_environment(venv_dir) + try: + virtualenv.create_environment(venv_dir) + + except AttributeError: + + # use cli_run for newer versions of virtualenv + from virtualenv import cli_run + + cli_run([venv_dir]) log.debug("Running virtualenv's pip install {}".format(name)) # call_subprocess here is used for convinience: since we already import From 7ea5c6bc22b1a75bd34d5bd00da9983325dd26dc Mon Sep 17 00:00:00 2001 From: Ciaran Ainsworth Date: Thu, 16 Apr 2020 00:08:43 +0100 Subject: [PATCH 2/3] remove new space --- pip_safe/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pip_safe/__init__.py b/pip_safe/__init__.py index 0fc1dfa..9d7cdea 100644 --- a/pip_safe/__init__.py +++ b/pip_safe/__init__.py @@ -9,6 +9,7 @@ from .utils import symlink, make_sure_path_exists, ensure_file_is_absent, call_subprocess + def confirm_smth(question): reply = str(six.moves.input(question + ' (y/Nn): ')).lower().strip() if reply and reply[0] == 'y': From aa57807a8061deba199b571eab36cd2791ee6162 Mon Sep 17 00:00:00 2001 From: Ciaran Ainsworth Date: Thu, 16 Apr 2020 00:11:35 +0100 Subject: [PATCH 3/3] Removed all new spaces --- pip_safe/__init__.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pip_safe/__init__.py b/pip_safe/__init__.py index 9d7cdea..d9b5226 100644 --- a/pip_safe/__init__.py +++ b/pip_safe/__init__.py @@ -102,14 +102,10 @@ def install_package(name, system_wide=False): log.debug('Creating virtualenv at {}'.format(venv_dir)) try: virtualenv.create_environment(venv_dir) - except AttributeError: - # use cli_run for newer versions of virtualenv from virtualenv import cli_run - cli_run([venv_dir]) - log.debug("Running virtualenv's pip install {}".format(name)) # call_subprocess here is used for convinience: since we already import # this, why not :)