From d744257af6517af5b1011a38495701ca2e794b7a Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 29 Sep 2020 17:59:31 -0500 Subject: [PATCH] Allow specifying python binary for common backup app environment also be sure to upgrade setuptools, wheel for it. this is needed esp. when deploying to older machines e.g. debian 8 --- rattail_fabric2/backup.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rattail_fabric2/backup.py b/rattail_fabric2/backup.py index 7b8601b..6748cf7 100644 --- a/rattail_fabric2/backup.py +++ b/rattail_fabric2/backup.py @@ -53,6 +53,7 @@ def deploy_backup_everything(c, **context): def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail', + python_exe='/usr/bin/python3', install_borg=False, link_borg_to_bin=True, install_luigi=False, @@ -86,12 +87,14 @@ def deploy_backup_app(c, deploy, envname, mkvirtualenv=True, user='rattail', c.sudo('supervisorctl stop backup:') # virtualenv - if mkvirtualenv: - python.mkvirtualenv(c, envname, python='/usr/bin/python3', runas_user=user) envpath = '/srv/envs/{}'.format(envname) + if mkvirtualenv and not exists(c, envpath): + python.mkvirtualenv(c, envname, python=python_exe, runas_user=user) + # TODO: this should not be necessary, right? c.sudo('chown -R {}: {}'.format(user, envpath)) mkdir(c, os.path.join(envpath, 'src'), use_sudo=True, runas_user=user) - c.sudo("bash -l -c 'workon {} && pip install --upgrade pip'".format(envname), user=user) + c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install -U pip setuptools wheel'".format(envpath), + user=user) if install_rattail: