aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/generate
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/cli/generate')
-rw-r--r--lib/python/qmk/cli/generate/keycodes_tests.py39
-rwxr-xr-xlib/python/qmk/cli/generate/make_dependencies.py4
-rwxr-xr-xlib/python/qmk/cli/generate/rules_mk.py2
3 files changed, 4 insertions, 41 deletions
diff --git a/lib/python/qmk/cli/generate/keycodes_tests.py b/lib/python/qmk/cli/generate/keycodes_tests.py
deleted file mode 100644
index 453b4693a7..0000000000
--- a/lib/python/qmk/cli/generate/keycodes_tests.py
+++ /dev/null
@@ -1,39 +0,0 @@
-"""Used by the make system to generate a keycode lookup table from keycodes_{version}.json
-"""
-from milc import cli
-
-from qmk.constants import GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE
-from qmk.commands import dump_lines
-from qmk.path import normpath
-from qmk.keycodes import load_spec
-
-
-def _generate_defines(lines, keycodes):
- lines.append('')
- lines.append('std::map<uint16_t, std::string> KEYCODE_ID_TABLE = {')
- for key, value in keycodes["keycodes"].items():
- lines.append(f' {{{value.get("key")}, "{value.get("key")}"}},')
- lines.append('};')
-
-
[email protected]('-v', '--version', arg_only=True, required=True, help='Version of keycodes to generate.')
[email protected]('-o', '--output', arg_only=True, type=normpath, help='File to write to')
[email protected]('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages")
[email protected]('Used by the make system to generate a keycode lookup table from keycodes_{version}.json', hidden=True)
-def generate_keycodes_tests(cli):
- """Generates a keycode to identifier lookup table for unit test output.
- """
-
- # Build the keycodes.h file.
- keycodes_h_lines = [GPL2_HEADER_C_LIKE, GENERATED_HEADER_C_LIKE, '// clang-format off']
- keycodes_h_lines.append('extern "C" {\n#include <keycode.h>\n}')
- keycodes_h_lines.append('#include <map>')
- keycodes_h_lines.append('#include <string>')
- keycodes_h_lines.append('#include <cstdint>')
-
- keycodes = load_spec(cli.args.version)
-
- _generate_defines(keycodes_h_lines, keycodes)
-
- # Show the results
- dump_lines(cli.args.output, keycodes_h_lines, cli.args.quiet)
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/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py
index ef4101d77f..01d71d277f 100755
--- a/lib/python/qmk/cli/generate/rules_mk.py
+++ b/lib/python/qmk/cli/generate/rules_mk.py
@@ -72,6 +72,8 @@ def generate_modules_rules(keyboard, filename):
lines.append(f'COMMUNITY_MODULE_PATHS += {module_path}')
lines.append(f'VPATH += {module_path}')
lines.append(f'SRC += $(wildcard {module_path}/{module_path.name}.c)')
+ lines.append(f'MODULE_NAME_{module_path.name.upper()} := {module_path.name}')
+ lines.append(f'MODULE_PATH_{module_path.name.upper()} := {module_path}')
lines.append(f'-include {module_path}/rules.mk')
module_jsons = load_module_jsons(modules)