Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb365b6850 | |||
| 7ff0f36338 |
@@ -1,6 +1,6 @@
|
|||||||
# QMK CLI
|
# QMK CLI
|
||||||
|
|
||||||
A program to help users work with QMK
|
A program to help users work with [QMK Firmware](https://qmk.fm/).
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
"""A program to help you work with qmk_firmware."""
|
"""A program to help you work with qmk_firmware."""
|
||||||
|
|
||||||
__version__ = '0.0.3'
|
__version__ = '0.0.4'
|
||||||
|
|||||||
@@ -7,95 +7,10 @@ import platform
|
|||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
import qmk_cli.doctor
|
||||||
from qmk_cli.milc import cli
|
from qmk_cli.milc import cli
|
||||||
|
|
||||||
|
|
||||||
def check_qmk_firmware():
|
|
||||||
"""Make sure qmk_firmware and the qmk cli are there.
|
|
||||||
"""
|
|
||||||
qmk_firmware = Path(os.environ['QMK_HOME'])
|
|
||||||
qmk_cli = qmk_firmware / 'bin' / 'qmk'
|
|
||||||
|
|
||||||
if qmk_firmware.exists() and not qmk_cli.exists():
|
|
||||||
cli.log.error("{fg_red}Can't find %s/bin/qmk! You need to `git pull`.", os.environ['QMK_HOME'])
|
|
||||||
return False
|
|
||||||
|
|
||||||
elif not qmk_firmware.exists():
|
|
||||||
cli.log.error("{fg_red}Can't find the qmk_firmware checkout! %s does not exist!", os.environ['QMK_HOME'])
|
|
||||||
return False
|
|
||||||
|
|
||||||
cli.log.info('Found qmk_firmware checkout in {fg_cyan}%s', str(qmk_firmware))
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def check_vital_programs():
|
|
||||||
"""Make sure the software we need has been installed.
|
|
||||||
|
|
||||||
TODO(unclaimed):
|
|
||||||
* [ ] Run the binaries to make sure they work
|
|
||||||
* [ ] Compile a trivial program with each compiler
|
|
||||||
"""
|
|
||||||
ok = True
|
|
||||||
binaries = ['dfu-programmer', 'avrdude', 'dfu-util', 'avr-gcc', 'arm-none-eabi-gcc']
|
|
||||||
|
|
||||||
for binary in binaries:
|
|
||||||
res = shutil.which(binary)
|
|
||||||
if res is None:
|
|
||||||
cli.log.error("{fg_red}QMK can't find %s in your path", binary)
|
|
||||||
ok = False
|
|
||||||
|
|
||||||
if ok:
|
|
||||||
cli.log.info("All necessary software is installed.")
|
|
||||||
|
|
||||||
return ok
|
|
||||||
|
|
||||||
|
|
||||||
def check_platform_tests():
|
|
||||||
"""Dispatch to platform specific tests.
|
|
||||||
"""
|
|
||||||
OS = platform.system()
|
|
||||||
|
|
||||||
if OS == "Darwin":
|
|
||||||
cli.log.info("Detected {fg_cyan}macOS")
|
|
||||||
return check_mac_os()
|
|
||||||
|
|
||||||
elif OS == "Linux":
|
|
||||||
cli.log.info("Detected {fg_cyan}linux")
|
|
||||||
return check_linux()
|
|
||||||
|
|
||||||
else:
|
|
||||||
cli.log.info("Assuming {fg_cyan}Windows")
|
|
||||||
return check_windows()
|
|
||||||
|
|
||||||
|
|
||||||
def check_mac_os():
|
|
||||||
"""Run macOS specific tests.
|
|
||||||
|
|
||||||
There aren't any yet.
|
|
||||||
"""
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def check_linux():
|
|
||||||
"""Run Linux specific tests.
|
|
||||||
|
|
||||||
TODO(unclaimed):
|
|
||||||
* [ ] Check for udev entries on linux
|
|
||||||
"""
|
|
||||||
test = 'systemctl list-unit-files | grep enabled | grep -i ModemManager'
|
|
||||||
if os.system(test) == 0:
|
|
||||||
cli.log.warn("{bg_yellow}Detected modem manager. Please disable it if you are using Pro Micros")
|
|
||||||
|
|
||||||
|
|
||||||
def check_windows():
|
|
||||||
"""Run Windows specific tests.
|
|
||||||
|
|
||||||
TODO(unclaimed):
|
|
||||||
* [ ] Check out the driver situation
|
|
||||||
"""
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
@cli.entrypoint('Basic QMK environment checks')
|
@cli.entrypoint('Basic QMK environment checks')
|
||||||
def main(cli):
|
def main(cli):
|
||||||
"""Basic QMK environment checks.
|
"""Basic QMK environment checks.
|
||||||
@@ -105,9 +20,9 @@ def main(cli):
|
|||||||
cli.log.info('QMK Doctor is checking your environment')
|
cli.log.info('QMK Doctor is checking your environment')
|
||||||
|
|
||||||
funcs = (
|
funcs = (
|
||||||
check_qmk_firmware,
|
qmk_cli.doctor.check_qmk_firmware,
|
||||||
check_vital_programs,
|
qmk_cli.doctor.check_vital_programs,
|
||||||
check_platform_tests,
|
qmk_cli.doctor.check_platform_tests,
|
||||||
)
|
)
|
||||||
|
|
||||||
ok = True
|
ok = True
|
||||||
|
|||||||
Reference in New Issue
Block a user