aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorZach White <skullydazed@users.noreply.github.com>2020-05-26 15:18:49 -0700
committerGitHub <noreply@github.com>2020-05-26 15:18:49 -0700
commita5e749d8cd76959e8103fff47d65725e19460d81 (patch)
tree9ac28352439267ad88b050c3c3f3c9433d54e760 /lib/python
parent4ee623fdd588edb9ac8816040f01d7644a49bd52 (diff)
downloadqmk_firmware-a5e749d8cd76959e8103fff47d65725e19460d81.tar.gz
qmk_firmware-a5e749d8cd76959e8103fff47d65725e19460d81.zip
Fix the path for generated keymaps (#9213)
Diffstat (limited to 'lib/python')
-rwxr-xr-xlib/python/qmk/cli/compile.py4
-rw-r--r--lib/python/qmk/keymap.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/python/qmk/cli/compile.py b/lib/python/qmk/cli/compile.py
index 6480d624b..341f365f8 100755
--- a/lib/python/qmk/cli/compile.py
+++ b/lib/python/qmk/cli/compile.py
@@ -7,7 +7,6 @@ from argparse import FileType
7 7
8from milc import cli 8from milc import cli
9 9
10import qmk.path
11from qmk.decorators import automagic_keyboard, automagic_keymap 10from qmk.decorators import automagic_keyboard, automagic_keymap
12from qmk.commands import compile_configurator_json, create_make_command, parse_configurator_json 11from qmk.commands import compile_configurator_json, create_make_command, parse_configurator_json
13 12
@@ -32,11 +31,8 @@ def compile(cli):
32 # If a configurator JSON was provided generate a keymap and compile it 31 # If a configurator JSON was provided generate a keymap and compile it
33 # FIXME(skullydazed): add code to check and warn if the keymap already exists when compiling a json keymap. 32 # FIXME(skullydazed): add code to check and warn if the keymap already exists when compiling a json keymap.
34 user_keymap = parse_configurator_json(cli.args.filename) 33 user_keymap = parse_configurator_json(cli.args.filename)
35 keymap_path = qmk.path.keymap(user_keymap['keyboard'])
36 command = compile_configurator_json(user_keymap) 34 command = compile_configurator_json(user_keymap)
37 35
38 cli.log.info('Wrote keymap to {fg_cyan}%s/%s/keymap.c', keymap_path, user_keymap['keymap'])
39
40 else: 36 else:
41 if cli.config.compile.keyboard and cli.config.compile.keymap: 37 if cli.config.compile.keyboard and cli.config.compile.keymap:
42 # Generate the make command for a specific keyboard/keymap. 38 # Generate the make command for a specific keyboard/keymap.
diff --git a/lib/python/qmk/keymap.py b/lib/python/qmk/keymap.py
index a2923f86d..78510a8a7 100644
--- a/lib/python/qmk/keymap.py
+++ b/lib/python/qmk/keymap.py
@@ -2,6 +2,8 @@
2""" 2"""
3from pathlib import Path 3from pathlib import Path
4 4
5from milc import cli
6
5from qmk.keyboard import rules_mk 7from qmk.keyboard import rules_mk
6import qmk.path 8import qmk.path
7 9
@@ -103,11 +105,13 @@ def write(keyboard, keymap, layout, layers):
103 An array of arrays describing the keymap. Each item in the inner array should be a string that is a valid QMK keycode. 105 An array of arrays describing the keymap. Each item in the inner array should be a string that is a valid QMK keycode.
104 """ 106 """
105 keymap_c = generate(keyboard, layout, layers) 107 keymap_c = generate(keyboard, layout, layers)
106 keymap_file = qmk.path.keymap(keyboard) / 'keymap.c' 108 keymap_file = qmk.path.keymap(keyboard) / keymap / 'keymap.c'
107 109
108 keymap_file.parent.mkdir(parents=True, exist_ok=True) 110 keymap_file.parent.mkdir(parents=True, exist_ok=True)
109 keymap_file.write_text(keymap_c) 111 keymap_file.write_text(keymap_c)
110 112
113 cli.log.info('Wrote keymap to {fg_cyan}%s', keymap_file)
114
111 return keymap_file 115 return keymap_file
112 116
113 117