mirror of
https://github.com/openstenoproject/qmk
synced 2024-11-10 02:30:07 +00:00
Begin the process of deprecating bin/qmk in favor of the global cli (#12109)
* Begin the process of deprecating bin/qmk in favor of the global cli * Correctly set the qmk bin
This commit is contained in:
parent
7d45b7f269
commit
b0069c5c05
6 changed files with 21 additions and 8 deletions
11
Makefile
11
Makefile
|
@ -29,6 +29,13 @@ $(info QMK Firmware $(QMK_VERSION))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Determine which qmk cli to use
|
||||||
|
ifeq (, $(shell which qmk))
|
||||||
|
QMK_BIN = bin/qmk
|
||||||
|
else
|
||||||
|
QMK_BIN = qmk
|
||||||
|
endif
|
||||||
|
|
||||||
# avoid 'Entering|Leaving directory' messages
|
# avoid 'Entering|Leaving directory' messages
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
|
@ -501,8 +508,8 @@ endef
|
||||||
%:
|
%:
|
||||||
# Check if we have the CMP tool installed
|
# Check if we have the CMP tool installed
|
||||||
cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
|
cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
|
||||||
# Ensure that bin/qmk works.
|
# Ensure that $(QMK_BIN) works.
|
||||||
if ! bin/qmk hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi
|
if ! $(QMK_BIN) hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi
|
||||||
# Check if the submodules are dirty, and display a warning if they are
|
# Check if the submodules are dirty, and display a warning if they are
|
||||||
ifndef SKIP_GIT
|
ifndef SKIP_GIT
|
||||||
if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi
|
if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi
|
||||||
|
|
2
bin/qmk
2
bin/qmk
|
@ -75,6 +75,8 @@ def main():
|
||||||
os.environ['ORIG_CWD'] = os.getcwd()
|
os.environ['ORIG_CWD'] = os.getcwd()
|
||||||
os.chdir(qmk_dir)
|
os.chdir(qmk_dir)
|
||||||
|
|
||||||
|
print('Warning: The bin/qmk script is being deprecated. Please install the QMK CLI: python3 -m pip install qmk', file=sys.stderr)
|
||||||
|
|
||||||
# Import the subcommands
|
# Import the subcommands
|
||||||
import qmk.cli # noqa
|
import qmk.cli # noqa
|
||||||
|
|
||||||
|
|
|
@ -28,4 +28,4 @@ endif
|
||||||
|
|
||||||
# Generate the keymap.c
|
# Generate the keymap.c
|
||||||
$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
|
$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
|
||||||
bin/qmk json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
|
$(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
|
||||||
|
|
|
@ -12,6 +12,9 @@ endif
|
||||||
|
|
||||||
include common.mk
|
include common.mk
|
||||||
|
|
||||||
|
# Set the qmk cli to use
|
||||||
|
QMK_BIN ?= qmk
|
||||||
|
|
||||||
# Set the filename for the final firmware binary
|
# Set the filename for the final firmware binary
|
||||||
KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
|
KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
|
||||||
TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
|
TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
|
||||||
|
@ -97,7 +100,7 @@ MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
|
||||||
MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
|
MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
|
||||||
|
|
||||||
# Pull in rules from info.json
|
# Pull in rules from info.json
|
||||||
INFO_RULES_MK = $(shell bin/qmk generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk)
|
INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk)
|
||||||
include $(INFO_RULES_MK)
|
include $(INFO_RULES_MK)
|
||||||
|
|
||||||
# Check for keymap.json first, so we can regenerate keymap.c
|
# Check for keymap.json first, so we can regenerate keymap.c
|
||||||
|
@ -294,10 +297,10 @@ endif
|
||||||
CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
|
CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
|
||||||
|
|
||||||
$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES)
|
$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES)
|
||||||
bin/qmk generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h
|
$(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h
|
||||||
|
|
||||||
$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES)
|
$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES)
|
||||||
bin/qmk generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h
|
$(QMK_BIN) generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h
|
||||||
|
|
||||||
generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
|
generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,7 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va
|
||||||
f'VERBOSE={verbose}',
|
f'VERBOSE={verbose}',
|
||||||
f'COLOR={color}',
|
f'COLOR={color}',
|
||||||
'SILENT=false',
|
'SILENT=false',
|
||||||
|
'QMK_BIN=qmk',
|
||||||
])
|
])
|
||||||
|
|
||||||
return make_command
|
return make_command
|
||||||
|
|
|
@ -8,7 +8,7 @@ is_windows = 'windows' in platform.platform().lower()
|
||||||
|
|
||||||
|
|
||||||
def check_subcommand(command, *args):
|
def check_subcommand(command, *args):
|
||||||
cmd = ['bin/qmk', command, *args]
|
cmd = ['qmk', command, *args]
|
||||||
result = run(cmd, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
|
result = run(cmd, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ def check_subcommand_stdin(file_to_read, command, *args):
|
||||||
"""Pipe content of a file to a command and return output.
|
"""Pipe content of a file to a command and return output.
|
||||||
"""
|
"""
|
||||||
with open(file_to_read, encoding='utf-8') as my_file:
|
with open(file_to_read, encoding='utf-8') as my_file:
|
||||||
cmd = ['bin/qmk', command, *args]
|
cmd = ['qmk', command, *args]
|
||||||
result = run(cmd, stdin=my_file, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
|
result = run(cmd, stdin=my_file, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue