1
0
mirror of https://github.com/ihabunek/toot synced 2024-12-22 23:08:17 +01:00

Added distribution info to toot diag (iff using Python 3.10+)

This commit is contained in:
Daniel Schwarz 2024-06-18 17:18:36 -04:00
parent b088ce9585
commit abe17695ba

View File

@ -329,12 +329,14 @@ def print_diags(include_files: bool):
import platform
click.echo(f'{green(f"Platform:")} {platform.platform()}')
# Uncomment this when we move to minimum Python version 3.10
# try:
# name = platform.freedesktop_os_release()['PRETTY_NAME']
# click.echo(f'{green(f"Distro:")} {name}')
# except: # noqa
# pass
# print distro - only call if available (python 3.10+)
fd_os_release = getattr(platform, "freedesktop_os_release", None) # novermin
if callable(fd_os_release): # novermin
try:
name = platform.freedesktop_os_release()['PRETTY_NAME']
click.echo(f'{green(f"Distro:")} {name}')
except: # noqa
pass
click.echo(f'{green(f"Python version:")} {platform.python_version()}')
click.echo(green("Dependency versions:"))