aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/cli')
-rw-r--r--lib/python/qmk/cli/doctor/check.py26
-rwxr-xr-xlib/python/qmk/cli/generate/make_dependencies.py4
-rw-r--r--lib/python/qmk/cli/lint.py13
3 files changed, 30 insertions, 13 deletions
diff --git a/lib/python/qmk/cli/doctor/check.py b/lib/python/qmk/cli/doctor/check.py
index 2804a1d7df..51b0f0c80a 100644
--- a/lib/python/qmk/cli/doctor/check.py
+++ b/lib/python/qmk/cli/doctor/check.py
@@ -54,10 +54,13 @@ 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:
@@ -65,8 +68,8 @@ def _check_arm_gcc_installation():
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:
@@ -91,10 +94,13 @@ 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:
@@ -102,8 +108,8 @@ def _check_avr_gcc_installation():
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:
diff --git a/lib/python/qmk/cli/generate/make_dependencies.py b/lib/python/qmk/cli/generate/make_dependencies.py
index 331132a20f..9548187888 100755
--- a/lib/python/qmk/cli/generate/make_dependencies.py
+++ b/lib/python/qmk/cli/generate/make_dependencies.py
@@ -8,7 +8,7 @@ from argcomplete.completers import FilesCompleter
from qmk.commands import dump_lines
from qmk.keyboard import keyboard_completer, keyboard_folder
from qmk.keymap import keymap_completer, locate_keymap
-from qmk.path import normpath, FileType
+from qmk.path import normpath, FileType, unix_style_path
@cli.argument('filename', nargs='?', arg_only=True, type=FileType('r'), completer=FilesCompleter('.json'), help='A configurator export JSON.')
@@ -53,4 +53,4 @@ def generate_make_dependencies(cli):
for file in interesting_files:
check_files.append(Path('users') / cli.args.keymap / file)
- dump_lines(cli.args.output, [f'generated-files: $(wildcard {found})\n' for found in check_files])
+ dump_lines(cli.args.output, [f'generated-files: $(wildcard {unix_style_path(found)})\n' for found in check_files])
diff --git a/lib/python/qmk/cli/lint.py b/lib/python/qmk/cli/lint.py
index bcf905f579..e2c76e4465 100644
--- a/lib/python/qmk/cli/lint.py
+++ b/lib/python/qmk/cli/lint.py
@@ -26,7 +26,7 @@ def _list_defaultish_keymaps(kb):
defaultish.extend(INVALID_KM_NAMES)
keymaps = set()
- for x in list_keymaps(kb):
+ for x in list_keymaps(kb, include_userspace=False):
if x in defaultish or x.startswith('default'):
keymaps.add(x)
@@ -171,6 +171,14 @@ def _handle_invalid_features(kb, info):
return ok
+def _handle_invalid_config(kb, info):
+ """Check for invalid keyboard level config
+ """
+ if info.get('url') == "":
+ cli.log.warning(f'{kb}: Invalid keyboard level config detected - Optional field "url" should not be empty.')
+ return True
+
+
def _chibios_conf_includenext_check(target):
"""Check the ChibiOS conf.h for the correct inclusion of the next conf.h
"""
@@ -255,6 +263,9 @@ def keyboard_check(kb): # noqa C901
if not _handle_invalid_features(kb, kb_info):
ok = False
+ if not _handle_invalid_config(kb, kb_info):
+ ok = False
+
invalid_files = git_get_ignored_files(f'keyboards/{kb}/')
for file in invalid_files:
if 'keymap' in file: