Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #8541 by getting version from -dumpversion then --version as fa… #8583

Merged
merged 4 commits into from
Apr 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions lib/python/qmk/cli/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
'dfu-programmer': {},
'avrdude': {},
skullydazed marked this conversation as resolved.
Show resolved Hide resolved
'dfu-util': {},
'avr-gcc': {},
'arm-none-eabi-gcc': {},
'avr-gcc': {
'version_arg': '-dumpversion'
},
'arm-none-eabi-gcc': {
'version_arg': '-dumpversion'
},
'bin/qmk': {},
}
ESSENTIAL_SUBMODULES = ['lib/chibios', 'lib/lufa']
Expand All @@ -36,9 +40,7 @@ def check_arm_gcc_version():
"""Returns True if the arm-none-eabi-gcc version is not known to cause problems.
"""
if 'output' in ESSENTIAL_BINARIES['arm-none-eabi-gcc']:
first_line = ESSENTIAL_BINARIES['arm-none-eabi-gcc']['output'].split('\n')[0]
second_half = first_line.split(')', 1)[1].strip()
version_number = second_half.split()[0]
version_number = ESSENTIAL_BINARIES['arm-none-eabi-gcc']['output'].strip()
cli.log.info('Found arm-none-eabi-gcc version %s', version_number)

return True # Right now all known arm versions are ok
Expand All @@ -48,8 +50,7 @@ def check_avr_gcc_version():
"""Returns True if the avr-gcc version is not known to cause problems.
"""
if 'output' in ESSENTIAL_BINARIES['avr-gcc']:
first_line = ESSENTIAL_BINARIES['avr-gcc']['output'].split('\n')[0]
version_number = first_line.split()[2]
version_number = ESSENTIAL_BINARIES['avr-gcc']['output'].strip()

major, minor, rest = version_number.split('.', 2)
if int(major) > 8:
Expand Down Expand Up @@ -154,14 +155,16 @@ def is_executable(command):
return False

# Make sure the command can be executed
check = run([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True)
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)

ESSENTIAL_BINARIES[command]['output'] = check.stdout

if check.returncode in [0, 1]: # Older versions of dfu-programmer exit 1
cli.log.debug('Found {fg_cyan}%s', command)
return True

cli.log.error("{fg_red}Can't run `%s --version`", command)
cli.log.error("{fg_red}Can't run `%s %s`", (command, version_arg))
return False


Expand Down