aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach White <skullydazed@gmail.com>2021-03-07 19:10:03 -0800
committerGitHub <noreply@github.com>2021-03-07 19:10:03 -0800
commitb0069c5c05dac2c910d51ef7f3bf4133721a9c49 (patch)
treeea8a7afb278f0ab4adb2e5390ef952c569ce3592
parent7d45b7f269ddcfc1b33a55d8fed77bdfbf81ba8b (diff)
downloadqmk_firmware-b0069c5c05dac2c910d51ef7f3bf4133721a9c49.tar.gz
qmk_firmware-b0069c5c05dac2c910d51ef7f3bf4133721a9c49.zip
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
-rw-r--r--Makefile11
-rwxr-xr-xbin/qmk2
-rw-r--r--build_json.mk2
-rw-r--r--build_keyboard.mk9
-rw-r--r--lib/python/qmk/commands.py1
-rw-r--r--lib/python/qmk/tests/test_cli_commands.py4
6 files changed, 21 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 91ab9e4e8..de0a2d415 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,13 @@ $(info QMK Firmware $(QMK_VERSION))
29endif 29endif
30endif 30endif
31 31
32# Determine which qmk cli to use
33ifeq (, $(shell which qmk))
34 QMK_BIN = bin/qmk
35else
36 QMK_BIN = qmk
37endif
38
32# avoid 'Entering|Leaving directory' messages 39# avoid 'Entering|Leaving directory' messages
33MAKEFLAGS += --no-print-directory 40MAKEFLAGS += --no-print-directory
34 41
@@ -501,8 +508,8 @@ endef
501%: 508%:
502 # Check if we have the CMP tool installed 509 # Check if we have the CMP tool installed
503 cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi; 510 cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi;
504 # Ensure that bin/qmk works. 511 # Ensure that $(QMK_BIN) works.
505 if ! bin/qmk hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi 512 if ! $(QMK_BIN) hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi
506 # Check if the submodules are dirty, and display a warning if they are 513 # Check if the submodules are dirty, and display a warning if they are
507ifndef SKIP_GIT 514ifndef SKIP_GIT
508 if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi 515 if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi
diff --git a/bin/qmk b/bin/qmk
index a3c1be328..28486026f 100755
--- a/bin/qmk
+++ b/bin/qmk
@@ -75,6 +75,8 @@ def main():
75 os.environ['ORIG_CWD'] = os.getcwd() 75 os.environ['ORIG_CWD'] = os.getcwd()
76 os.chdir(qmk_dir) 76 os.chdir(qmk_dir)
77 77
78 print('Warning: The bin/qmk script is being deprecated. Please install the QMK CLI: python3 -m pip install qmk', file=sys.stderr)
79
78 # Import the subcommands 80 # Import the subcommands
79 import qmk.cli # noqa 81 import qmk.cli # noqa
80 82
diff --git a/build_json.mk b/build_json.mk
index 6e2f9c4c8..8822be6a1 100644
--- a/build_json.mk
+++ b/build_json.mk
@@ -28,4 +28,4 @@ endif
28 28
29# Generate the keymap.c 29# Generate the keymap.c
30$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON) 30$(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON)
31 bin/qmk json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON) 31 $(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON)
diff --git a/build_keyboard.mk b/build_keyboard.mk
index 366d1f5d2..74046a094 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -12,6 +12,9 @@ endif
12 12
13include common.mk 13include common.mk
14 14
15# Set the qmk cli to use
16QMK_BIN ?= qmk
17
15# Set the filename for the final firmware binary 18# Set the filename for the final firmware binary
16KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD)) 19KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD))
17TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP) 20TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP)
@@ -97,7 +100,7 @@ MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
97MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP) 100MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
98 101
99# Pull in rules from info.json 102# Pull in rules from info.json
100INFO_RULES_MK = $(shell bin/qmk generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk) 103INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk)
101include $(INFO_RULES_MK) 104include $(INFO_RULES_MK)
102 105
103# Check for keymap.json first, so we can regenerate keymap.c 106# Check for keymap.json first, so we can regenerate keymap.c
@@ -294,10 +297,10 @@ endif
294CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h 297CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
295 298
296$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES) 299$(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES)
297 bin/qmk generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h 300 $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h
298 301
299$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES) 302$(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES)
300 bin/qmk generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h 303 $(QMK_BIN) generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h
301 304
302generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h 305generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h
303 306
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index 3c6f0d001..233d1034b 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -180,6 +180,7 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va
180 f'VERBOSE={verbose}', 180 f'VERBOSE={verbose}',
181 f'COLOR={color}', 181 f'COLOR={color}',
182 'SILENT=false', 182 'SILENT=false',
183 'QMK_BIN=qmk',
183 ]) 184 ])
184 185
185 return make_command 186 return make_command
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py
index 82c42a20e..bfecebdd7 100644
--- a/lib/python/qmk/tests/test_cli_commands.py
+++ b/lib/python/qmk/tests/test_cli_commands.py
@@ -8,7 +8,7 @@ is_windows = 'windows' in platform.platform().lower()
8 8
9 9
10def check_subcommand(command, *args): 10def check_subcommand(command, *args):
11 cmd = ['bin/qmk', command, *args] 11 cmd = ['qmk', command, *args]
12 result = run(cmd, stdout=PIPE, stderr=STDOUT, universal_newlines=True) 12 result = run(cmd, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
13 return result 13 return result
14 14
@@ -17,7 +17,7 @@ def check_subcommand_stdin(file_to_read, command, *args):
17 """Pipe content of a file to a command and return output. 17 """Pipe content of a file to a command and return output.
18 """ 18 """
19 with open(file_to_read, encoding='utf-8') as my_file: 19 with open(file_to_read, encoding='utf-8') as my_file:
20 cmd = ['bin/qmk', command, *args] 20 cmd = ['qmk', command, *args]
21 result = run(cmd, stdin=my_file, stdout=PIPE, stderr=STDOUT, universal_newlines=True) 21 result = run(cmd, stdin=my_file, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
22 return result 22 return result
23 23