From 00fb1bd1f0550645997b61870d7d092494265a60 Mon Sep 17 00:00:00 2001 From: skullY Date: Tue, 12 Nov 2019 17:08:55 -0800 Subject: [PATCH] Make generating keymap.c from JSON more reliable --- build_json.mk | 5 ++--- lib/python/qmk/cli/json/keymap.py | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build_json.mk b/build_json.mk index e2a33e3b6a5..3e7dc95c0c1 100644 --- a/build_json.mk +++ b/build_json.mk @@ -22,6 +22,5 @@ else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.json)","") endif # Generate the keymap.c -ifneq ("$(KEYMAP_JSON)","") - _ = $(shell test -e $(KEYMAP_C) || bin/qmk json-keymap $(KEYMAP_JSON) -o $(KEYMAP_C)) -endif +$(KEYBOARD_OUTPUT)/src/keymap.c: + bin/qmk json-keymap --quiet --output $(KEYMAP_C) $(KEYMAP_JSON) diff --git a/lib/python/qmk/cli/json/keymap.py b/lib/python/qmk/cli/json/keymap.py index 207ac278caf..7b7553104f0 100755 --- a/lib/python/qmk/cli/json/keymap.py +++ b/lib/python/qmk/cli/json/keymap.py @@ -10,6 +10,7 @@ import qmk.keymap @cli.argument('-o', '--output', arg_only=True, help='File to write to') +@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") @cli.argument('filename', arg_only=True, help='Configurator JSON file') @cli.subcommand('Creates a keymap.c from a QMK Configurator export.') def json_keymap(cli): @@ -48,7 +49,8 @@ def json_keymap(cli): with open(output_file, 'w') as keymap_fd: keymap_fd.write(keymap_c) - cli.log.info('Wrote keymap to %s.', cli.args.output) + if not cli.args.quiet: + cli.log.info('Wrote keymap to %s.', cli.args.output) else: print(keymap_c)