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