Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translation: Improve BIDI/RTF support and minor mods #1732

Merged
merged 33 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0bfffec
remove obsolete entries not by default
buhtz May 21, 2024
9aa6a5a
doc-dev localization
buhtz May 21, 2024
c8a1685
minor fixes
buhtz May 27, 2024
d00f47f
minor pep8
buhtz May 27, 2024
a8e4908
minor pep8
buhtz May 27, 2024
dd184b6
improve support for BIDI/RTF languages
buhtz May 27, 2024
0e4b364
more RTF/BIDI
buhtz May 27, 2024
bfa1a6f
minor mods
buhtz May 28, 2024
1e00151
more RTF/BIDI
buhtz May 28, 2024
daaae34
Fix #1610
buhtz May 28, 2024
713a248
fix codespell typo
buhtz May 28, 2024
fd26f76
Merge branch 'dev' into neotranslation
buhtz May 28, 2024
2dc8d85
remove -> removal
buhtz May 28, 2024
11d4994
x
buhtz May 29, 2024
f1f283c
known host msg box
buhtz May 29, 2024
1ba23cf
x
buhtz May 29, 2024
f1ffbf2
[skip CI]
buhtz May 29, 2024
c729e67
[skip ci]
buhtz May 29, 2024
bd97ea7
mountexceptions
buhtz May 30, 2024
e774217
"Information" in plural form and minor mods
buhtz May 30, 2024
d5d16a9
minor [skip ci]
buhtz May 30, 2024
c7455a9
minor [skip ci]
buhtz May 30, 2024
df82554
Merge branch 'dev' into neotranslation
buhtz Jun 1, 2024
748e44d
Merge branch 'dev' into neotranslation
buhtz Jun 2, 2024
6ea77f1
improved rsync diagnostics
buhtz Jun 3, 2024
1f88378
improved rsync diagnostics
buhtz Jun 3, 2024
1d075b5
x
buhtz Jun 3, 2024
29d29d0
clean
buhtz Jun 3, 2024
21d891f
Merge branch 'feat/1742installedfrom' into neotranslation
buhtz Jun 4, 2024
6ae0cc2
Merge branch 'neotranslation' of github.com:buhtz/backintime into neo…
buhtz Jun 4, 2024
7937bd5
fix
buhtz Jun 4, 2024
4c56367
fixed readme
buhtz Jun 4, 2024
e481521
rephrased and documented password prompt
buhtz Jun 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ them in your own rsync script, too. But to name some features:

- Inhibit suspend/hibernate during take snapshot
- Shutdown system after finish
- Auto- and Smart-Remove
- Auto- and Smart-Removal
- Plugin- and user-callback support


Expand Down
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ In the latest stable release:
- [`qt5_probing.py` may hang with high CPU usage when running BiT as `root` via `cron`](#qt5_probingpy-may-hang-with-high-cpu-usage-when-running-bit-as-root-via-cron)

In older releases:
- RTE "module 'qttools' has no attribute 'initate_translator'" with encFS when prompting the user for a password ([#1553](https://github.com/bit-team/backintime/issues/#1553))
- Error: "module 'qttools' has no attribute 'initate_translator'" with EncFS when prompting the user for a password ([#1553](https://github.com/bit-team/backintime/issues/1553))
- [Tray icon or other icons not shown correctly](#tray-icon-or-other-icons-not-shown-correctly)
- [Non-working password safe and BiT forgets passwords (keyring backend issues)](#non-working-password-safe-and-bit-forgets-passwords-keyring-backend-issues)
- [Incompatibility with rsync >= 3.2.4](#incompatibility-with-rsync-324-or-newer)
- [Python 3.10 compatibility and Ubuntu version](#python-310-compatibility-and-ubuntu-version)

More problems described in
[this FAQ section](FAQ.md#problems-errors--solutions).
Expand Down Expand Up @@ -192,14 +191,6 @@ Note that some GNU/Linux distributions (e.g. Manjaro) using a workaround with
environment variable `RSYNC_OLD_ARGS` in their distro-specific packages for
_Back In Time_. In that case you may not see any problems.

### Python 3.10 compatibility and Ubuntu version

_Back In Time_ versions older than 1.3.2 do not start with Python >= 3.10.
Ubuntu 22.04 LTS ships with Python 3.10 and backintime 1.2.1, but has applied
[a patch](https://bugs.launchpad.net/ubuntu/+source/backintime/+bug/1976164/+attachment/5593556/+files/backintime_1.2.1-3_1.2.1-3ubuntu0.1.diff)
to make it work. If you want to update _Back In Time_, you may use one of the
[alternative options for installation](#alternative-installation-options).

# Contributing and other ways to support the project
See [CONTRIBUTING](CONTRIBUTING.md) file for an overview about the projects
workflow and strategy.
Expand Down
10 changes: 5 additions & 5 deletions common/backintime.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def createParsers(app_name = 'backintime'):

command = 'smart-remove'
nargs = 0
description = 'Remove snapshots based on "Smart Remove" pattern.'
description = 'Remove snapshots based on "Smart Removal" pattern.'
smartRemoveCP = subparsers.add_parser(command,
epilog = epilogCommon,
help = description,
Expand Down Expand Up @@ -1118,15 +1118,15 @@ def removeAndDoNotAskAgain(args):

def smartRemove(args):
"""
Command for running Smart-Remove from Terminal.
Command for running Smart-Removal from Terminal.

Args:
args (argparse.Namespace):
previously parsed arguments

Raises:
SystemExit: 0 if okay
2 if Smart-Remove is not configured
2 if Smart-Removal is not configured
"""
setQuiet(args)
printHeader()
Expand All @@ -1141,12 +1141,12 @@ def smartRemove(args):
keep_one_per_day,
keep_one_per_week,
keep_one_per_month)
logger.info('Smart Remove will remove {} snapshots'.format(len(del_snapshots)))
logger.info('Smart Removal will remove {} snapshots'.format(len(del_snapshots)))
sn.smartRemove(del_snapshots, log = logger.info)
_umount(cfg)
sys.exit(RETURN_OK)
else:
logger.error('Smart Remove is not configured.')
logger.error('Smart Removal is not configured.')
sys.exit(RETURN_NO_CFG)

def restore(args):
Expand Down
67 changes: 40 additions & 27 deletions common/config.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# Back In Time
# Copyright (C) 2008-2022 Oprea Dan, Bart de Koning, Richard Bailey,
# Germar Reitze
# Back In Time
# Copyright (C) 2008-2022 Oprea Dan, Bart de Koning, Richard Bailey,
# Germar Reitze
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""Configuration logic.

This module and its `Config` class contain the application logic handling the
Expand All @@ -28,15 +27,14 @@
`backintime-config`. The script `create-manpage-backintime-config.py`
parses this module for that.
"""

import os
import sys
import datetime
import socket
import random
import textwrap
import getpass
import shlex

# Workaround: Mostly relevant on TravisCI but not exclusively.
# While unittesting and without regular invocation of BIT the GNU gettext
# class-based API isn't setup yet.
Expand Down Expand Up @@ -300,10 +298,10 @@ def __init__(self, config_path=None, data_path=None):
'local': (
None, _('Local'), False, False),
'ssh': (
sshtools.SSH, 'SSH', _('SSH private key'), False),
sshtools.SSH, _('SSH'), _('SSH private key'), False),
'local_encfs': (
encfstools.EncFS_mount,
'{} {}'.format(_('Local'), _('encrypted')),
_('Local encrypted'),
_('Encryption'),
False
),
Expand Down Expand Up @@ -491,7 +489,7 @@ def setSnapshotsPath(self, value, profile_id = None, mode = None):
elif fs == 'fuse.sshfs' and mode not in ('ssh', 'ssh_encfs'):
self.notifyError(_(
"Destination filesystem for {path} is an sshfs-mounted share."
" sshfs doesn't support hard-links. "
" Sshfs doesn't support hard-links. "
"Please use mode 'SSH' instead.")
.format(path=value))

Expand Down Expand Up @@ -845,22 +843,35 @@ def setPasswordUseCache(self, value, profile_id = None, mode = None):
mode = self.snapshotsMode(profile_id)
self.setProfileBoolValue('snapshots.%s.password.use_cache' % mode, value, profile_id)

def password(self, parent = None, profile_id = None, mode = None, pw_id = 1, only_from_keyring = False):
def password(self,
parent=None,
profile_id=None,
mode=None,
pw_id=1,
only_from_keyring=False):

if self.pw is None:
self.pw = password.Password(self)

if profile_id is None:
profile_id = self.currentProfile()

if mode is None:
mode = self.snapshotsMode(profile_id)
return self.pw.password(parent, profile_id, mode, pw_id, only_from_keyring)

def setPassword(self, password, profile_id = None, mode = None, pw_id = 1):
return self.pw.password(
parent, profile_id, mode, pw_id, only_from_keyring)

def setPassword(self, password, profile_id=None, mode=None, pw_id=1):
if self.pw is None:
self.pw = password.Password(self)

if profile_id is None:
profile_id = self.currentProfile()

if mode is None:
mode = self.snapshotsMode(profile_id)

self.pw.setPassword(password, profile_id, mode, pw_id)

def modeNeedPassword(self, mode, pw_id = 1):
Expand Down Expand Up @@ -1636,10 +1647,12 @@ def setupCron(self):

else:
logger.error('crontab not found.', self)
self.notifyError(_(
"Can't find crontab.\n"
"Are you sure cron is installed?\n"
"If not you should disable all automatic backups."))
msg = _("Can't find crontab. Are you sure cron is "
"installed? If not you should disable all "
"automatic backups.")
msg = '\n'.join(textwrap.wrap(msg, 72))
self.notifyError(msg)

return False

if not tools.writeCrontab(newCrontab):
Expand Down
82 changes: 52 additions & 30 deletions common/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def collect_minimal_diagnostics():
'backintime': {
'name': config.Config.APP_NAME,
'version': version.__version__,
'running-as-root': pwd.getpwuid(os.getuid()) == 'root'
'running-as-root': pwd.getpwuid(os.getuid()) == 'root',
},
'host-setup': {
'OS': _get_os_release()
Expand Down Expand Up @@ -154,35 +154,7 @@ def collect_diagnostics():
# === EXTERN TOOL ===
result['external-programs'] = {}

# rsync
# rsync >= 3.2.7: -VV return a json
# rsync <= 3.2.6 and > (somewhere near) 3.1.3: -VV return the same as -V
# rsync <= (somewhere near) 3.1.3: -VV doesn't exists
# rsync == 3.1.3 (Ubuntu 20 LTS) doesn't even know '-V'

# This works when rsync understands -VV and returns json or human readable
result['external-programs']['rsync'] = _get_extern_versions(
['rsync', '-VV'],
r'rsync version (.*) protocol version',
try_json=True,
error_pattern=r'unknown option'
)

# When -VV was unknown use -V and parse the human readable output
if not result['external-programs']['rsync']:
# try the old way
result['external-programs']['rsync'] = _get_extern_versions(
['rsync', '--version'],
r'rsync version (.*) protocol version'
)
elif isinstance(result['external-programs']['rsync'], dict):
# Rsync (>= 3.2.7)provided its information in JSON format.
# Remove some irrelevant information.
for key in ['program', 'copyright', 'url', 'license', 'caveat']:
try:
del result['external-programs']['rsync'][key]
except KeyError:
pass
result['external-programs']['rsync'] = _get_rsync_info()

# ssh
result['external-programs']['ssh'] = _get_extern_versions(['ssh', '-V'])
Expand Down Expand Up @@ -215,6 +187,7 @@ def collect_diagnostics():
return result



def _get_qt_information():
"""Collect Version and Theme information from Qt.

Expand Down Expand Up @@ -317,6 +290,55 @@ def _get_extern_versions(cmd,
return result.strip() # as string


def _get_rsync_info():
"""Collect infos about rsync.

Returns:
dict: Collected info
"""
# rsync
# rsync >= 3.2.7: -VV return a json
# rsync <= 3.2.6 and > (somewhere near) 3.1.3: -VV return the same as -V
# rsync <= (somewhere near) 3.1.3: -VV doesn't exists
# rsync == 3.1.3 (Ubuntu 20 LTS) doesn't even know '-V'

# This works when rsync understands -VV and returns json or human readable
info = _get_extern_versions(
['rsync', '-VV'],
r'rsync version (.*) protocol version',
try_json=True,
error_pattern=r'unknown option'
)

# When -VV was unknown use -V and parse the human readable output
if not info:
# try the old way
info = _get_extern_versions(
['rsync', '--version'],
r'rsync version (.*) protocol version'
)

elif isinstance(info, dict):
# Rsync (>= 3.2.7)provided its information in JSON format.
# Remove some irrelevant information.
for key in ['program', 'copyright', 'url', 'license', 'caveat']:
try:
del info[key]
except KeyError:
pass

# Reduce use of vertical space with transforming lists and dicts into
# strings.
for key in ['daemon_auth_list', 'compress_list', 'checksum_list',
'optimizations', 'capabilities']:
if isinstance(info[key], list):
info[key] = ', '.join(info[key])
elif isinstance(info[key], dict):
info[key] = '; '.join(f'{k}: {v}' for k, v in info[key].items())

return info


def _get_os_release():
"""Try to get the name and version of the operating system used.

Expand Down
Loading