aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/cli')
-rwxr-xr-xlib/python/qmk/cli/doctor.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/python/qmk/cli/doctor.py b/lib/python/qmk/cli/doctor.py
index 9b81c8508..65b6f0a96 100755
--- a/lib/python/qmk/cli/doctor.py
+++ b/lib/python/qmk/cli/doctor.py
@@ -10,6 +10,7 @@ from pathlib import Path
10from milc import cli 10from milc import cli
11from qmk import submodules 11from qmk import submodules
12from qmk.questions import yesno 12from qmk.questions import yesno
13from qmk.commands import run
13 14
14ESSENTIAL_BINARIES = { 15ESSENTIAL_BINARIES = {
15 'dfu-programmer': {}, 16 'dfu-programmer': {},
@@ -135,7 +136,7 @@ def check_modem_manager():
135 """Returns True if ModemManager is running. 136 """Returns True if ModemManager is running.
136 """ 137 """
137 if shutil.which("systemctl"): 138 if shutil.which("systemctl"):
138 mm_check = subprocess.run(["systemctl", "--quiet", "is-active", "ModemManager.service"], timeout=10) 139 mm_check = run(["systemctl", "--quiet", "is-active", "ModemManager.service"], timeout=10)
139 if mm_check.returncode == 0: 140 if mm_check.returncode == 0:
140 return True 141 return True
141 142
@@ -153,7 +154,7 @@ def is_executable(command):
153 return False 154 return False
154 155
155 # Make sure the command can be executed 156 # Make sure the command can be executed
156 check = subprocess.run([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True) 157 check = run([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True)
157 ESSENTIAL_BINARIES[command]['output'] = check.stdout 158 ESSENTIAL_BINARIES[command]['output'] = check.stdout
158 159
159 if check.returncode in [0, 1]: # Older versions of dfu-programmer exit 1 160 if check.returncode in [0, 1]: # Older versions of dfu-programmer exit 1
@@ -207,19 +208,19 @@ def doctor(cli):
207 ok = True 208 ok = True
208 209
209 # Determine our OS and run platform specific tests 210 # Determine our OS and run platform specific tests
210 OS = platform.platform().lower() # noqa (N806), uppercase name is ok in this instance 211 platform_id = platform.platform().lower()
211 212
212 if 'darwin' in OS or 'macos' in OS: 213 if 'darwin' in platform_id or 'macos' in platform_id:
213 if not os_test_macos(): 214 if not os_test_macos():
214 ok = False 215 ok = False
215 elif 'linux' in OS: 216 elif 'linux' in platform_id:
216 if not os_test_linux(): 217 if not os_test_linux():
217 ok = False 218 ok = False
218 elif 'windows' in OS: 219 elif 'windows' in platform_id:
219 if not os_test_windows(): 220 if not os_test_windows():
220 ok = False 221 ok = False
221 else: 222 else:
222 cli.log.error('Unsupported OS detected: %s', OS) 223 cli.log.error('Unsupported OS detected: %s', platform_id)
223 ok = False 224 ok = False
224 225
225 # Make sure the basic CLI tools we need are available and can be executed. 226 # Make sure the basic CLI tools we need are available and can be executed.
@@ -227,7 +228,7 @@ def doctor(cli):
227 228
228 if not bin_ok: 229 if not bin_ok:
229 if yesno('Would you like to install dependencies?', default=True): 230 if yesno('Would you like to install dependencies?', default=True):
230 subprocess.run(['util/qmk_install.sh']) 231 run(['util/qmk_install.sh'])
231 bin_ok = check_binaries() 232 bin_ok = check_binaries()
232 233
233 if bin_ok: 234 if bin_ok: