1
0
Fork 0

Use version_arg in ESSENTIAL_BINARIES dict

This commit is contained in:
Ross Baquir 2020-03-30 17:41:58 -07:00 committed by skullydazed
parent 3fad3854d6
commit 70b5015162

View file

@ -16,8 +16,8 @@ ESSENTIAL_BINARIES = {
'dfu-programmer': {}, 'dfu-programmer': {},
'avrdude': {}, 'avrdude': {},
'dfu-util': {}, 'dfu-util': {},
'avr-gcc': {}, 'avr-gcc': {'version_arg': '-dumpversion'},
'arm-none-eabi-gcc': {}, 'arm-none-eabi-gcc': {'version_arg': '-dumpversion'},
'bin/qmk': {}, 'bin/qmk': {},
} }
ESSENTIAL_SUBMODULES = ['lib/chibios', 'lib/lufa'] ESSENTIAL_SUBMODULES = ['lib/chibios', 'lib/lufa']
@ -151,10 +151,8 @@ def is_executable(command):
return False return False
# Make sure the command can be executed # Make sure the command can be executed
check = subprocess.run([command, '-dumpversion'], 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)
if check.returncode > 1: # if -dumpversion returns error check with --version instead
check = subprocess.run([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5, universal_newlines=True)
ESSENTIAL_BINARIES[command]['output'] = check.stdout ESSENTIAL_BINARIES[command]['output'] = check.stdout