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

Fix 'Would you like to clone the submodules?' prompt under msys #24958

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Fix 'Would you like to clone the submodules?' prompt under msys
  • Loading branch information
zvecr committed Feb 27, 2025
commit 0cbef1644beb22716edc968e58e19910b1889107
26 changes: 16 additions & 10 deletions lib/python/qmk/cli/doctor/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,22 @@ def _check_arm_gcc_installation():
"""Returns OK if the arm-none-eabi-gcc is fully installed and can produce binaries.
"""
with TemporaryDirectory() as temp_dir:
temp_file = Path(temp_dir) / 'test.elf'
temp_in = Path(temp_dir) / 'test.c'
temp_out = Path(temp_dir) / 'test.elf'

args = ['arm-none-eabi-gcc', '-mcpu=cortex-m0', '-mthumb', '-mno-thumb-interwork', '--specs=nosys.specs', '--specs=nano.specs', '-x', 'c', '-o', str(temp_file), '-']
result = cli.run(args, stdin=None, stdout=None, stderr=None, input='#include <newlib.h>\nint main() { return __NEWLIB__ * __NEWLIB_MINOR__ * __NEWLIB_PATCHLEVEL__; }')
temp_in.write_text('#include <newlib.h>\nint main() { return __NEWLIB__ * __NEWLIB_MINOR__ * __NEWLIB_PATCHLEVEL__; }', encoding='utf-8')

args = ['arm-none-eabi-gcc', '-mcpu=cortex-m0', '-mthumb', '-mno-thumb-interwork', '--specs=nosys.specs', '--specs=nano.specs', '-x', 'c', '-o', str(temp_out), str(temp_in)]
result = cli.run(args, stdout=None, stderr=None)
if result.returncode == 0:
cli.log.info('Successfully compiled using arm-none-eabi-gcc')
else:
cli.log.error(f'Failed to compile a simple program with arm-none-eabi-gcc, return code {result.returncode}')
cli.log.error(f'Command: {" ".join(args)}')
return CheckStatus.ERROR

args = ['arm-none-eabi-size', str(temp_file)]
result = cli.run(args, stdin=None, stdout=None, stderr=None)
args = ['arm-none-eabi-size', str(temp_out)]
result = cli.run(args, stdout=None, stderr=None)
if result.returncode == 0:
cli.log.info('Successfully tested arm-none-eabi-binutils using arm-none-eabi-size')
else:
Expand All @@ -91,19 +94,22 @@ def _check_avr_gcc_installation():
"""Returns OK if the avr-gcc is fully installed and can produce binaries.
"""
with TemporaryDirectory() as temp_dir:
temp_file = Path(temp_dir) / 'test.elf'
temp_in = Path(temp_dir) / 'test.c'
temp_out = Path(temp_dir) / 'test.elf'

temp_in.write_text('int main() { return 0; }', encoding='utf-8')

args = ['avr-gcc', '-mmcu=atmega32u4', '-x', 'c', '-o', str(temp_file), '-']
result = cli.run(args, stdin=None, stdout=None, stderr=None, input='int main() { return 0; }')
args = ['avr-gcc', '-mmcu=atmega32u4', '-x', 'c', '-o', str(temp_out), str(temp_in)]
result = cli.run(args, stdout=None, stderr=None)
if result.returncode == 0:
cli.log.info('Successfully compiled using avr-gcc')
else:
cli.log.error(f'Failed to compile a simple program with avr-gcc, return code {result.returncode}')
cli.log.error(f'Command: {" ".join(args)}')
return CheckStatus.ERROR

args = ['avr-size', str(temp_file)]
result = cli.run(args, stdin=None, stdout=None, stderr=None)
args = ['avr-size', str(temp_out)]
result = cli.run(args, stdout=None, stderr=None)
if result.returncode == 0:
cli.log.info('Successfully tested avr-binutils using avr-size')
else:
Expand Down