Add more options when installing pip, virtualenvwrapper

some of these were needed to support an older Ubuntu 14.04 machine
This commit is contained in:
Lance Edgar 2020-03-31 21:31:54 -05:00
parent 218d9e5476
commit f6bc14f94c

View file

@ -32,7 +32,10 @@ from rattail_fabric2 import apt, exists, make_deploy, mkdir
deploy = make_deploy(__file__) deploy = make_deploy(__file__)
def bootstrap_python(c, pip_from_apt=True, workon_home='/srv/envs', user='rattail'): def bootstrap_python(c, pip_from_apt=True, pip_eager=True,
virtualenvwrapper_from_apt=False,
upgrade_virtualenvwrapper=True,
workon_home='/srv/envs', user='rattail'):
""" """
Bootstrap a "complete" Python install. Bootstrap a "complete" Python install.
""" """
@ -47,11 +50,14 @@ def bootstrap_python(c, pip_from_apt=True, workon_home='/srv/envs', user='rattai
) )
# pip # pip
install_pip(c, use_apt=pip_from_apt) install_pip(c, use_apt=pip_from_apt, eager=pip_eager)
# virtualenvwrapper # virtualenvwrapper
workon_home = workon_home.rstrip('/') workon_home = workon_home.rstrip('/')
install_virtualenvwrapper(c, workon_home=workon_home, user=user, configure_me=False) install_virtualenvwrapper(c, workon_home=workon_home, user=user,
use_apt=virtualenvwrapper_from_apt,
upgrade=upgrade_virtualenvwrapper,
configure_me=False)
deploy(c, 'python/premkvirtualenv', '{}/premkvirtualenv'.format(workon_home), owner=user, use_sudo=True) deploy(c, 'python/premkvirtualenv', '{}/premkvirtualenv'.format(workon_home), owner=user, use_sudo=True)
@ -142,7 +148,8 @@ def pip(c, *packages, **kwargs):
c.run(cmd) c.run(cmd)
def install_virtualenvwrapper(c, workon_home='/srv/envs', user='root', use_apt=False, configure_me=True): def install_virtualenvwrapper(c, workon_home='/srv/envs', user='root',
use_apt=False, upgrade=True, configure_me=True):
""" """
Install the `virtualenvwrapper`_ system, with the given ``workon`` home, Install the `virtualenvwrapper`_ system, with the given ``workon`` home,
owned by the given user. owned by the given user.
@ -151,7 +158,7 @@ def install_virtualenvwrapper(c, workon_home='/srv/envs', user='root', use_apt=F
if use_apt: if use_apt:
apt.install(c, 'virtualenvwrapper') apt.install(c, 'virtualenvwrapper')
else: else:
pip(c, 'virtualenvwrapper', upgrade=True) pip(c, 'virtualenvwrapper', upgrade=upgrade)
configure_virtualenvwrapper(c, user, workon_home) configure_virtualenvwrapper(c, user, workon_home)
if configure_me: if configure_me:
# TODO # TODO
@ -159,7 +166,8 @@ def install_virtualenvwrapper(c, workon_home='/srv/envs', user='root', use_apt=F
raise NotImplementedError raise NotImplementedError
def configure_virtualenvwrapper(c, user, workon_home='/srv/envs', wrapper='/usr/local/bin/virtualenvwrapper.sh'): def configure_virtualenvwrapper(c, user, workon_home='/srv/envs',
wrapper='/usr/local/bin/virtualenvwrapper.sh'):
""" """
Configure virtualenvwrapper for the given user account. Configure virtualenvwrapper for the given user account.
""" """