From bf4ac2f676c0c7951e607c88330e30215f69b7a7 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 31 May 2018 21:54:30 -0500 Subject: [PATCH] Let caller specify pip version when invoking `python.mkvirtualenv()` --- rattail_fabric/python.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rattail_fabric/python.py b/rattail_fabric/python.py index 7c07ad6..20e6cb4 100644 --- a/rattail_fabric/python.py +++ b/rattail_fabric/python.py @@ -106,9 +106,13 @@ def mkvirtualenv(name, python=None, user=None, workon_home=None, upgrade_pip=Tru workon_home = workon_home or getattr(env, 'python_workon_home', '/srv/envs') sudo('mkvirtualenv {} {}'.format('--python={}'.format(python) if python else '', name)) if upgrade_pip: + if isinstance(upgrade_pip, six.string_types): + pip_req = upgrade_pip + else: + pip_req = 'pip' with workon(name): pip('six') - pip('pip', 'setuptools', 'wheel', 'ndg-httpsclient') + pip(pip_req, 'setuptools', 'wheel', 'ndg-httpsclient') if user: with cdvirtualenv(name, workon_home=workon_home): mkdir('app/log', owner='{0}:{0}'.format(user))