diff options
| author | Ryan <fauxpark@gmail.com> | 2020-04-06 02:11:55 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-05 18:11:55 +0200 |
| commit | 6de77141a4f7d45b19a148674beba1beb6711472 (patch) | |
| tree | 2e3a3628dae42232cbe93cf121ed2daa10906102 /lib | |
| parent | 6f6c2e1c5c2e619aeec0d64a5a7156aed9fd559d (diff) | |
| download | qmk_firmware-6de77141a4f7d45b19a148674beba1beb6711472.tar.gz qmk_firmware-6de77141a4f7d45b19a148674beba1beb6711472.zip | |
Doctor: Add avrdude/dfu-util/dfu-programmer version printing (#8678)
* Doctor: Add avrdude/dfu-util/dfu-programmer version printing
* Extra newline
* Iterate through version checking functions
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/python/qmk/cli/doctor.py | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/lib/python/qmk/cli/doctor.py b/lib/python/qmk/cli/doctor.py index e46e6c777..3e6f6fe54 100755 --- a/lib/python/qmk/cli/doctor.py +++ b/lib/python/qmk/cli/doctor.py | |||
| @@ -63,6 +63,33 @@ def check_avr_gcc_version(): | |||
| 63 | return False | 63 | return False |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | def check_avrdude_version(): | ||
| 67 | if 'output' in ESSENTIAL_BINARIES['avrdude']: | ||
| 68 | last_line = ESSENTIAL_BINARIES['avrdude']['output'].split('\n')[-2] | ||
| 69 | version_number = last_line.split()[2][:-1] | ||
| 70 | cli.log.info('Found avrdude version %s', version_number) | ||
| 71 | |||
| 72 | return True | ||
| 73 | |||
| 74 | |||
| 75 | def check_dfu_util_version(): | ||
| 76 | if 'output' in ESSENTIAL_BINARIES['dfu-util']: | ||
| 77 | first_line = ESSENTIAL_BINARIES['dfu-util']['output'].split('\n')[0] | ||
| 78 | version_number = first_line.split()[1] | ||
| 79 | cli.log.info('Found dfu-util version %s', version_number) | ||
| 80 | |||
| 81 | return True | ||
| 82 | |||
| 83 | |||
| 84 | def check_dfu_programmer_version(): | ||
| 85 | if 'output' in ESSENTIAL_BINARIES['dfu-programmer']: | ||
| 86 | first_line = ESSENTIAL_BINARIES['dfu-programmer']['output'].split('\n')[0] | ||
| 87 | version_number = first_line.split()[1] | ||
| 88 | cli.log.info('Found dfu-programmer version %s', version_number) | ||
| 89 | |||
| 90 | return True | ||
| 91 | |||
| 92 | |||
| 66 | def check_binaries(): | 93 | def check_binaries(): |
| 67 | """Iterates through ESSENTIAL_BINARIES and tests them. | 94 | """Iterates through ESSENTIAL_BINARIES and tests them. |
| 68 | """ | 95 | """ |
| @@ -156,7 +183,7 @@ def is_executable(command): | |||
| 156 | 183 | ||
| 157 | # Make sure the command can be executed | 184 | # Make sure the command can be executed |
| 158 | version_arg = ESSENTIAL_BINARIES[command].get('version_arg', '--version') | 185 | version_arg = ESSENTIAL_BINARIES[command].get('version_arg', '--version') |
| 159 | check = subprocess.run([command, version_arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True) | 186 | check = run([command, version_arg], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=5, universal_newlines=True) |
| 160 | 187 | ||
| 161 | ESSENTIAL_BINARIES[command]['output'] = check.stdout | 188 | ESSENTIAL_BINARIES[command]['output'] = check.stdout |
| 162 | 189 | ||
| @@ -240,11 +267,9 @@ def doctor(cli): | |||
| 240 | ok = False | 267 | ok = False |
| 241 | 268 | ||
| 242 | # Make sure the tools are at the correct version | 269 | # Make sure the tools are at the correct version |
| 243 | if not check_arm_gcc_version(): | 270 | for check in (check_arm_gcc_version, check_avr_gcc_version, check_avrdude_version, check_dfu_util_version, check_dfu_programmer_version): |
| 244 | ok = False | 271 | if not check(): |
| 245 | 272 | ok = False | |
| 246 | if not check_avr_gcc_version(): | ||
| 247 | ok = False | ||
| 248 | 273 | ||
| 249 | # Check out the QMK submodules | 274 | # Check out the QMK submodules |
| 250 | sub_ok = check_submodules() | 275 | sub_ok = check_submodules() |
