From 4973950ddcef28d94a1fc589951e024a91a240d7 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Thu, 19 Jan 2023 10:25:47 +0000 Subject: Print distro in doctor output (#19633) --- lib/python/qmk/cli/doctor/check.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/python/qmk/cli/doctor/check.py') diff --git a/lib/python/qmk/cli/doctor/check.py b/lib/python/qmk/cli/doctor/check.py index 426876e98a..cd69cdd11c 100644 --- a/lib/python/qmk/cli/doctor/check.py +++ b/lib/python/qmk/cli/doctor/check.py @@ -158,3 +158,21 @@ def is_executable(command): cli.log.error("{fg_red}Can't run `%s %s`", command, version_arg) return False + + +def release_info(file='/etc/os-release'): + """Parse release info to dict + """ + ret = {} + try: + with open(file) as f: + for line in f: + if '=' in line: + key, value = map(str.strip, line.split('=', 1)) + if value.startswith('"') and value.endswith('"'): + value = value[1:-1] + ret[key] = value + except (PermissionError, FileNotFoundError): + pass + + return ret -- cgit v1.2.3