-
-
Notifications
You must be signed in to change notification settings - Fork 39.5k
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
Fixes #8541 by getting version from -dumpversion then --version as fa… #8583
Conversation
I think it might be clearer to simply add a |
The following is working well on MSYS and macOS: diff --git a/lib/python/qmk/cli/doctor.py b/lib/python/qmk/cli/doctor.py
index 9b81c8508..18fe5a9b9 100755
--- a/lib/python/qmk/cli/doctor.py
+++ b/lib/python/qmk/cli/doctor.py
@@ -15,8 +15,8 @@ ESSENTIAL_BINARIES = {
'dfu-programmer': {},
'avrdude': {},
'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']
@@ -35,9 +35,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
@@ -47,8 +45,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:
@@ -153,7 +150,8 @@ def is_executable(command):
return False
# Make sure the command can be executed
- check = subprocess.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 |
lib/python/qmk/cli/doctor.py
Outdated
@@ -154,14 +151,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 = run([command, version_arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check = 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) |
Since @fauxpark found out avrdude
prints the help to stderr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And dfu-programmer
.
5941c13
to
53b4450
Compare
Description
When running
qmk setup
orqmk doctor
would get error as referenced in #8541. The problem likely came from a change in the formatting ofavr-gcc --version
. Instead I used the flag-dumpversion
and made it fallback to--version
if it returned an error. Changed the cli.log string and the version checking to match the new output values.Types of Changes
Issues Fixed or Closed by This PR
ValueError
#8541Checklist