summaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/doctor/check.py
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2023-01-19 10:25:47 +0000
committerGitHub <noreply@github.com>2023-01-19 10:25:47 +0000
commit4973950ddcef28d94a1fc589951e024a91a240d7 (patch)
treea52fba64d5198fc219fc201ac286dd97aa7458b9 /lib/python/qmk/cli/doctor/check.py
parent3723c0e3d57f0afdff0e1b7421d26d6c7f6c980d (diff)
Print distro in doctor output (#19633)
Diffstat (limited to 'lib/python/qmk/cli/doctor/check.py')
-rw-r--r--lib/python/qmk/cli/doctor/check.py18
1 files changed, 18 insertions, 0 deletions
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