diff options
author | Ryan <fauxpark@gmail.com> | 2020-04-06 02:11:55 +1000 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2020-06-12 17:00:27 +0900 |
commit | 50b109c13393d61be68513bbf454312562248607 (patch) | |
tree | c6387097a1a09aefdc85afa154c4890e25ac5cd8 | |
parent | 8a8e1593d6a670c0e1d5c914aa4adba5549abe17 (diff) |
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
-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 e46e6c777d..3e6f6fe54e 100755 --- a/lib/python/qmk/cli/doctor.py +++ b/lib/python/qmk/cli/doctor.py @@ -63,6 +63,33 @@ def check_avr_gcc_version(): return False +def check_avrdude_version(): + if 'output' in ESSENTIAL_BINARIES['avrdude']: + last_line = ESSENTIAL_BINARIES['avrdude']['output'].split('\n')[-2] + version_number = last_line.split()[2][:-1] + cli.log.info('Found avrdude version %s', version_number) + + return True + + +def check_dfu_util_version(): + if 'output' in ESSENTIAL_BINARIES['dfu-util']: + first_line = ESSENTIAL_BINARIES['dfu-util']['output'].split('\n')[0] + version_number = first_line.split()[1] + cli.log.info('Found dfu-util version %s', version_number) + + return True + + +def check_dfu_programmer_version(): + if 'output' in ESSENTIAL_BINARIES['dfu-programmer']: + first_line = ESSENTIAL_BINARIES['dfu-programmer']['output'].split('\n')[0] + version_number = first_line.split()[1] + cli.log.info('Found dfu-programmer version %s', version_number) + + return True + + def check_binaries(): """Iterates through ESSENTIAL_BINARIES and tests them. """ @@ -156,7 +183,7 @@ def is_executable(command): # Make sure the command can be executed version_arg = ESSENTIAL_BINARIES[command].get('version_arg', '--version') - check = subprocess.run([command, version_arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True) + check = run([command, version_arg], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=5, universal_newlines=True) ESSENTIAL_BINARIES[command]['output'] = check.stdout @@ -240,11 +267,9 @@ def doctor(cli): ok = False # Make sure the tools are at the correct version - if not check_arm_gcc_version(): - ok = False - - if not check_avr_gcc_version(): - ok = False + for check in (check_arm_gcc_version, check_avr_gcc_version, check_avrdude_version, check_dfu_util_version, check_dfu_programmer_version): + if not check(): + ok = False # Check out the QMK submodules sub_ok = check_submodules() |