diff options
| author | Ross Baquir <streakinthesky@gmail.com> | 2020-03-27 20:09:21 -0700 |
|---|---|---|
| committer | skullydazed <skullydazed@users.noreply.github.com> | 2020-04-04 12:43:13 -0700 |
| commit | 3fad3854d67e41464475e5551669a5c683d3c67d (patch) | |
| tree | 8b83b1caa56298bc9c5192b72a35c0297bd2f414 /lib | |
| parent | 38d7145da280a3fad108327ac849832aa2c75d2f (diff) | |
| download | qmk_firmware-3fad3854d67e41464475e5551669a5c683d3c67d.tar.gz qmk_firmware-3fad3854d67e41464475e5551669a5c683d3c67d.zip | |
Fixes #8541 by getting version from -dumpversion then --version as fallback
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/python/qmk/cli/doctor.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/python/qmk/cli/doctor.py b/lib/python/qmk/cli/doctor.py index 65b6f0a96..002301455 100755 --- a/lib/python/qmk/cli/doctor.py +++ b/lib/python/qmk/cli/doctor.py | |||
| @@ -36,9 +36,7 @@ def check_arm_gcc_version(): | |||
| 36 | """Returns True if the arm-none-eabi-gcc version is not known to cause problems. | 36 | """Returns True if the arm-none-eabi-gcc version is not known to cause problems. |
| 37 | """ | 37 | """ |
| 38 | if 'output' in ESSENTIAL_BINARIES['arm-none-eabi-gcc']: | 38 | if 'output' in ESSENTIAL_BINARIES['arm-none-eabi-gcc']: |
| 39 | first_line = ESSENTIAL_BINARIES['arm-none-eabi-gcc']['output'].split('\n')[0] | 39 | version_number = ESSENTIAL_BINARIES['arm-none-eabi-gcc']['output'].strip() |
| 40 | second_half = first_line.split(')', 1)[1].strip() | ||
| 41 | version_number = second_half.split()[0] | ||
| 42 | cli.log.info('Found arm-none-eabi-gcc version %s', version_number) | 40 | cli.log.info('Found arm-none-eabi-gcc version %s', version_number) |
| 43 | 41 | ||
| 44 | return True # Right now all known arm versions are ok | 42 | return True # Right now all known arm versions are ok |
| @@ -48,8 +46,7 @@ def check_avr_gcc_version(): | |||
| 48 | """Returns True if the avr-gcc version is not known to cause problems. | 46 | """Returns True if the avr-gcc version is not known to cause problems. |
| 49 | """ | 47 | """ |
| 50 | if 'output' in ESSENTIAL_BINARIES['avr-gcc']: | 48 | if 'output' in ESSENTIAL_BINARIES['avr-gcc']: |
| 51 | first_line = ESSENTIAL_BINARIES['avr-gcc']['output'].split('\n')[0] | 49 | version_number = ESSENTIAL_BINARIES['avr-gcc']['output'].strip() |
| 52 | version_number = first_line.split()[2] | ||
| 53 | 50 | ||
| 54 | major, minor, rest = version_number.split('.', 2) | 51 | major, minor, rest = version_number.split('.', 2) |
| 55 | if int(major) > 8: | 52 | if int(major) > 8: |
| @@ -154,14 +151,18 @@ def is_executable(command): | |||
| 154 | return False | 151 | return False |
| 155 | 152 | ||
| 156 | # Make sure the command can be executed | 153 | # Make sure the command can be executed |
| 157 | check = run([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True) | 154 | check = subprocess.run([command, '-dumpversion'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True) |
| 155 | |||
| 156 | if check.returncode > 1: # if -dumpversion returns error check with --version instead | ||
| 157 | check = subprocess.run([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True) | ||
| 158 | |||
| 158 | ESSENTIAL_BINARIES[command]['output'] = check.stdout | 159 | ESSENTIAL_BINARIES[command]['output'] = check.stdout |
| 159 | 160 | ||
| 160 | if check.returncode in [0, 1]: # Older versions of dfu-programmer exit 1 | 161 | if check.returncode in [0, 1]: # Older versions of dfu-programmer exit 1 |
| 161 | cli.log.debug('Found {fg_cyan}%s', command) | 162 | cli.log.debug('Found {fg_cyan}%s', command) |
| 162 | return True | 163 | return True |
| 163 | 164 | ||
| 164 | cli.log.error("{fg_red}Can't run `%s --version`", command) | 165 | cli.log.error("{fg_red}Can't get version number of `%s`", command) |
| 165 | return False | 166 | return False |
| 166 | 167 | ||
| 167 | 168 | ||
