diagnostics module
Provides the ability to collect diagnostic information on Back In Time.
These are version numbers of the dependent tools, environment variables, paths, operating system and the like. This is used to enhance error reports and to enrich them with the necessary information as uncomplicated as possible.
- diagnostics._get_extern_versions(cmd, pattern=None, try_json=False, error_pattern=None)[source]
Get the version of an external tools using
subprocess.Popen
.- Parameters:
cmd (list[str]) – Commandline arguments that will be passed to
Popen()
.pattern (str) – A regex pattern to extract the version string from the commands output.
try_json (bool) – Interpret the output as json first (default:
False
). If it could be parsed the result is a dicterror_pattern (str) – Regex pattern to identify a message in the output that indicates an error.
- Returns:
Version information as
str
ordict
. The latter is used if thecmd
requested offer its information in JSON format.None
if the error_pattern did match (to indicate an error).
- diagnostics._get_os_release()[source]
Try to get the name and version of the operating system used.
First it extract infos from the file
/etc/os-release
. Because not all GNU Linux distributions follow the standards it will also look for alternative release files (pattern:/etc/*release
). See http://linuxmafia.com/faq/Admin/release-files.html for examples.- Returns:
A string with the name of the operating system, e.g. “Debian GNU/Linux 11 (bullseye)” or a dictionary if alternative release files where found.
- diagnostics._get_qt_information()[source]
Collect Version and Theme information from Qt.
If environment variable
DISPLAY
is set a temporary QApplication instances is created.
- diagnostics._replace_username_paths(result, username)[source]
User’s real
HOME
path and login name are replaced with surrogtes.This is because of security reasons.