Changeset 1fedc31 in rattail-fabric2


Ignore:
Timestamp:
11/27/2022 06:47:43 PM (2 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
a3339ac
Parents:
a9bbee5
Message:

Add pyfuse3 support for backup (borg) app

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail_fabric2/backup.py

    ra9bbee5 r1fedc31  
    33#
    44#  Rattail -- Retail Software Framework
    5 #  Copyright © 2010-2019 Lance Edgar
     5#  Copyright © 2010-2022 Lance Edgar
    66#
    77#  This file is part of Rattail.
     
    5656                      python_exe='/usr/bin/python3',
    5757                      install_borg=False,
     58                      pyfuse3=False,
    5859                      link_borg_to_bin=True,
    5960                      install_luigi=False,
     
    9293    if mkvirtualenv and not exists(c, envpath):
    9394        python.mkvirtualenv(c, envname, python=python_exe, runas_user=user)
    94     # TODO: this should not be necessary, right?
    95     c.sudo('chown -R {}: {}'.format(user, envpath))
     95        # TODO: this should not be necessary, right?
     96        c.sudo('chown -R {}: {}'.format(user, envpath))
     97        c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install -U pip setuptools wheel'".format(envpath),
     98               user=user)
    9699    mkdir(c, os.path.join(envpath, 'src'), use_sudo=True, runas_user=user)
    97     c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install -U pip setuptools wheel'".format(envpath),
    98            user=user)
    99100
    100101    if install_rattail:
     
    132133    # borg
    133134    if install_borg:
    134         if install_rattail:
    135             packages = [
    136                 'rattail[backup]',
    137             ]
    138         else:
    139             # TODO: these should be same as rattail[backup]
    140             packages = [
    141                 'msgpack',
    142                 'borgbackup[fuse]',
    143             ]
    144         c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install {1}'".format(envpath, ' '.join(packages)),
     135        if isinstance(install_borg, list):
     136            packages = install_borg
     137        elif isinstance(install_borg, str):
     138            packages = [install_borg]
     139        else:
     140            packages = ['msgpack']
     141            if pyfuse3:
     142                apt.install(c, 'libfuse3-dev')
     143                packages.append('borgbackup[pyfuse3]')
     144            else:
     145                # TODO: this is legacy and should stop being default
     146                packages.append('borgbackup[fuse]')
     147            c.sudo("bash -c 'PIP_CONFIG_FILE={0}/pip.conf {0}/bin/pip install {1}'".format(envpath, ' '.join(packages)),
    145148               user=user)
    146149        if link_borg_to_bin:
Note: See TracChangeset for help on using the changeset viewer.