Let caller specify pip version when invoking python.mkvirtualenv()

This commit is contained in:
Lance Edgar 2018-05-31 21:54:30 -05:00
parent 2c5e073168
commit bf4ac2f676

View file

@ -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') workon_home = workon_home or getattr(env, 'python_workon_home', '/srv/envs')
sudo('mkvirtualenv {} {}'.format('--python={}'.format(python) if python else '', name)) sudo('mkvirtualenv {} {}'.format('--python={}'.format(python) if python else '', name))
if upgrade_pip: if upgrade_pip:
if isinstance(upgrade_pip, six.string_types):
pip_req = upgrade_pip
else:
pip_req = 'pip'
with workon(name): with workon(name):
pip('six') pip('six')
pip('pip', 'setuptools', 'wheel', 'ndg-httpsclient') pip(pip_req, 'setuptools', 'wheel', 'ndg-httpsclient')
if user: if user:
with cdvirtualenv(name, workon_home=workon_home): with cdvirtualenv(name, workon_home=workon_home):
mkdir('app/log', owner='{0}:{0}'.format(user)) mkdir('app/log', owner='{0}:{0}'.format(user))