7 Commits
3.1.2 ... 3.2.1

Author SHA1 Message Date
631ffa85d3 Remove broken desktop notifications 2023-05-05 19:23:21 +02:00
fe2d66c24c Remove data_files from setup.cfg 2023-05-05 19:12:41 +02:00
97419c30f9 Use setuptools to build the project 2023-05-05 19:03:23 +02:00
c6871ac81a Bump PKGBUILD version 2023-05-04 23:42:55 +02:00
90120031e2 Update PKGBUILD 2023-05-04 23:21:12 +02:00
d61ffa199a Use setuptools 2023-05-04 23:16:15 +02:00
a4c4b88193 Fix PKGBUILD 2023-05-02 18:10:43 +02:00
8 changed files with 115 additions and 38 deletions

View File

@ -1,33 +1,47 @@
#Arch Linux PKGBUILD # PKGBUILD
#
#Maintainer: Daniele Fucini <dfucini@gmail.com> # Maintainer: Daniele Fucini <dfucini@gmail.com>
#
pkgname=simple_backup pkgname=simple_backup
pkgver=2.0.0.r3.gc61c704 pkgver=3.1.2.r1.ga4c4b88
pkgrel=1 pkgrel=1
pkgdesc='Simple backup script that uses rsync to copy files' pkgdesc='Simple backup script that uses rsync to copy files'
arch=('any') arch=('any')
url="https://github.com/Fuxino/simple_backup.git" url="https://github.com/Fuxino/simple_backup.git"
license=('GPL3') license=('GPL3')
makedepends=('git') makedepends=('git'
depends=('python3' 'python-setuptools'
'python-build'
'python-installer'
'python-wheel')
depends=('python'
'rsync' 'rsync'
'python-dotenv' 'python-dotenv')
'python-dbus' optdepends=('python-systemd: use systemd log')
'python-systemd')
install=${pkgname}.install install=${pkgname}.install
source=(git+https://github.com/Fuxino/${pkgname}.git) source=(git+https://github.com/Fuxino/${pkgname}.git)
sha256sums=('SKIP') sha256sums=('SKIP')
pkgver() pkgver()
{ {
cd "$pkgname" cd ${pkgname}
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
} }
prepare()
{
git -C ${srcdir}/${pkgname} clean -dfx
}
build()
{
cd ${srcdir}/${pkgname}
python -m build --wheel --no-isolation
}
package() package()
{ {
install -Dm755 "${srcdir}/${pkgname}/${pkgname}.py" "${pkgdir}/usr/bin/${pkgname}" cd ${srcdir}/${pkgname}
install -Dm644 "${srcdir}/${pkgname}/${pkgname}.config" "${pkgdir}/etc/${pkgname}/${pkgname}.conf" python -m installer --destdir=${pkgdir} dist/*.whl
install -Dm644 ${srcdir}/${pkgname}/${pkgname}.conf ${pkgdir}/etc/${pkgname}/${pkgname}.conf
} }

View File

@ -1,10 +1,40 @@
# simple_backup simple_backup
============
A simple backup script A simple backup script
## Description ## Description
simple_backup is a Python script that allows you to backup your files. simple_backup is a Python script that allows you to backup your files.
It reads from a configuration file the files/directories that must be copied, Parameters like input files/directories, output directory etc. can be specified in a configuration file, or on the command line.
the destination directory for the backup and a few other options. Run:
```bash
simple_backup -h
```
to print all possible command line options.
## Dependencies ## Dependencies
rsync is used to perform the backup. The script uses rsync to actually run the backup, so you will have to install it on your system. For example on Arch Linux:
```bash
sudo pacman -Syu rsync
```
## Install
To install the program, first clone the repository:
```bash
git clone https://github.com/Fuxino/simple_backup.git
```
Then run:
```bash
cd simple_backup
python -m build --wheel
python -m installer dist/*.whl
For Arch Linux, a PKGBUILD that automates this process is provided.
After installing, copy simple_backup.conf (if you used the PKGBUILD on Arch, it will be in /etc/simple_backup/) to $HOME/.config/simple_backup and edit is as needed.

3
pyproject.toml Normal file
View File

@ -0,0 +1,3 @@
[build-system]
requires = ['setuptools']
build-backend = 'setuptools.build_meta'

View File

@ -1 +0,0 @@
python-dotenv>=1.0.0

33
setup.cfg Normal file
View File

@ -0,0 +1,33 @@
[metadata]
name = simple_backup
version = attr: simple_backup.__version__
description = Simple backup script using rsync
long_description = file: README.md
author = Daniele Fucini
author_email = dfucini@gmail.com
license = GPL3
url = https://github.com/Fuxino/simple_backup
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Natural Language :: English
Operating System :: POSIX :: Linux
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: System :: Archiving :: Backup
[options]
packages = simple_backup
python_requires = >=3.7
install_requires =
python-dotenv
systemd-python
[options.entry_points]
console_scripts =
simple_backup = simple_backup:simple_backup

View File

@ -0,0 +1,3 @@
"""Init."""
__version__ = '3.1.2'

View File

@ -0,0 +1,14 @@
#Example config file for simple_backup
[default]
#Input directories. Use a comma to separate items
inputs=/home/my_home,/etc
#Output directory
backup_dir=/media/Backup
#Exclude patterns. Use a comma to separate items
exclude=.gvfs,.local/share/gvfs-metadata,.cache,.dbus,.Trash,.local/share/Trash,.macromedia,.adobe,.recently-used,.recently-used.xbel,.thumbnails
#Number of snapshots to keep (use -1 to keep all)
keep=-1

View File

@ -12,7 +12,6 @@ from timeit import default_timer
from subprocess import Popen, PIPE, STDOUT from subprocess import Popen, PIPE, STDOUT
from datetime import datetime from datetime import datetime
from tempfile import mkstemp from tempfile import mkstemp
import dbus
from dotenv import load_dotenv from dotenv import load_dotenv
try: try:
@ -236,10 +235,6 @@ class Backup:
if self._err_flag: if self._err_flag:
logger.warning('Some errors occurred (check log for details)') logger.warning('Some errors occurred (check log for details)')
return 1
return 0
def _parse_arguments(): def _parse_arguments():
parser = argparse.ArgumentParser(prog='simple_backup', parser = argparse.ArgumentParser(prog='simple_backup',
@ -304,21 +299,7 @@ def simple_backup():
backup = Backup(inputs, output, exclude, keep, backup_options) backup = Backup(inputs, output, exclude, keep, backup_options)
if backup.check_params(): if backup.check_params():
try: backup.run()
obj = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
obj = dbus.Interface(obj, "org.freedesktop.Notifications")
obj.Notify("simple_backup", 0, "", "Starting backup...", "", [], {"urgency": 1}, 10000)
except dbus.exceptions.DBusException:
obj = None
status = backup.run()
if obj is not None:
if status == 0:
obj.Notify("simple_backup", 0, "", "Backup finished.", "", [], {"urgency": 1}, 10000)
else:
obj.Notify("simple_backup", 0, "", "Backup finished. Some errors occurred.",
"", [], {"urgency": 1}, 10000)
return 0 return 0