You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

  1. """QMK Python Doctor
  2. Check up for QMK environment.
  3. """
  4. import shutil
  5. import platform
  6. import os
  7. from milc import cli
  8. @cli.entrypoint('Basic QMK environment checks')
  9. def main(cli):
  10. """Basic QMK environment checks.
  11. This is currently very simple, it just checks that all the expected binaries are on your system.
  12. TODO(unclaimed):
  13. * [ ] Run the binaries to make sure they work
  14. * [ ] Compile a trivial program with each compiler
  15. * [ ] Check for udev entries on linux
  16. """
  17. binaries = ['dfu-programmer', 'avrdude', 'dfu-util', 'avr-gcc', 'arm-none-eabi-gcc']
  18. cli.log.info('QMK Doctor is Checking your environment')
  19. ok = True
  20. for binary in binaries:
  21. res = shutil.which(binary)
  22. if res is None:
  23. cli.log.error('{fg_red}QMK can\'t find ' + binary + ' in your path')
  24. ok = False
  25. OS = platform.system()
  26. if OS == "Darwin":
  27. cli.log.info("Detected {fg_cyan}macOS")
  28. elif OS == "Linux":
  29. cli.log.info("Detected {fg_cyan}linux")
  30. test = 'systemctl list-unit-files | grep enabled | grep -i ModemManager'
  31. if os.system(test) == 0:
  32. cli.log.warn("{bg_yellow}Detected modem manager. Please disable it if you are using Pro Micros")
  33. else:
  34. cli.log.info("Assuming {fg_cyan}Windows")
  35. if ok:
  36. cli.log.info('{fg_green}QMK is ready to go')