aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach White <skullydazed@gmail.com>2021-08-29 16:50:22 -0700
committerGitHub <noreply@github.com>2021-08-29 16:50:22 -0700
commit596c4a1f87b46e1858c7d3630802eec741d1cc28 (patch)
tree4985aa763eca968615ae7b8004261fa76262a389
parentb46064a891332db07643f73018910c031a63aa50 (diff)
downloadqmk_firmware-596c4a1f87b46e1858c7d3630802eec741d1cc28.tar.gz
qmk_firmware-596c4a1f87b46e1858c7d3630802eec741d1cc28.zip
Remove bin/qmk (#14231)
* Remove the bin/qmk script * remove bin/qmk from workflows
-rw-r--r--.github/labeler.yml1
-rw-r--r--.github/workflows/cli.yml1
-rw-r--r--Makefile6
-rwxr-xr-xbin/qmk58
-rw-r--r--docs/contributing.md2
-rw-r--r--docs/de/cli.md19
-rw-r--r--docs/fr-fr/cli.md19
-rw-r--r--keyboards/dztech/dz65rgb/keymaps/jumper149/readme.md4
-rw-r--r--lib/python/qmk/cli/doctor/check.py1
-rwxr-xr-xlib/python/qmk/cli/format/python.py6
-rw-r--r--lib/python/qmk/cli/pytest.py2
-rw-r--r--lib/python/qmk/commands.py2
-rw-r--r--lib/python/qmk/tests/test_cli_commands.py2
-rw-r--r--shell.nix2
14 files changed, 11 insertions, 114 deletions
diff --git a/.github/labeler.yml b/.github/labeler.yml
index 53921f7f9..41b2475f6 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -22,7 +22,6 @@ keymap:
22via: 22via:
23 - keyboards/**/keymaps/via/* 23 - keyboards/**/keymaps/via/*
24cli: 24cli:
25 - bin/qmk
26 - requirements.txt 25 - requirements.txt
27 - lib/python/**/* 26 - lib/python/**/*
28python: 27python:
diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml
index 7a8dc8540..3bf9741ac 100644
--- a/.github/workflows/cli.yml
+++ b/.github/workflows/cli.yml
@@ -8,7 +8,6 @@ on:
8 pull_request: 8 pull_request:
9 paths: 9 paths:
10 - 'lib/python/**' 10 - 'lib/python/**'
11 - 'bin/qmk'
12 - 'requirements.txt' 11 - 'requirements.txt'
13 - '.github/workflows/cli.yml' 12 - '.github/workflows/cli.yml'
14 13
diff --git a/Makefile b/Makefile
index bb2201e85..269be720c 100644
--- a/Makefile
+++ b/Makefile
@@ -30,11 +30,7 @@ endif
30endif 30endif
31 31
32# Determine which qmk cli to use 32# Determine which qmk cli to use
33ifeq (,$(shell which qmk)) 33QMK_BIN := qmk
34 QMK_BIN = bin/qmk
35else
36 QMK_BIN = qmk
37endif
38 34
39# avoid 'Entering|Leaving directory' messages 35# avoid 'Entering|Leaving directory' messages
40MAKEFLAGS += --no-print-directory 36MAKEFLAGS += --no-print-directory
diff --git a/bin/qmk b/bin/qmk
deleted file mode 100755
index 617f99282..000000000
--- a/bin/qmk
+++ /dev/null
@@ -1,58 +0,0 @@
1#!/usr/bin/env python3
2"""CLI wrapper for running QMK commands.
3"""
4import os
5import sys
6from pathlib import Path
7
8# Add the QMK python libs to our path
9script_dir = Path(os.path.realpath(__file__)).parent
10qmk_dir = script_dir.parent
11python_lib_dir = Path(qmk_dir / 'lib' / 'python').resolve()
12sys.path.append(str(python_lib_dir))
13
14# Setup the CLI
15import milc # noqa
16
17milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
18
19
20@milc.cli.entrypoint('QMK Helper Script')
21def qmk_main(cli):
22 """The function that gets run when no subcommand is provided.
23 """
24 cli.print_help()
25
26
27def main():
28 """Setup our environment and then call the CLI entrypoint.
29 """
30 # Change to the root of our checkout
31 os.environ['ORIG_CWD'] = os.getcwd()
32 os.environ['DEPRECATED_BIN_QMK'] = '1'
33 os.chdir(qmk_dir)
34
35 print('Warning: The bin/qmk script is being deprecated. Please install the QMK CLI: python3 -m pip install qmk', file=sys.stderr)
36
37 # Import the subcommands
38 import milc.subcommand.config # noqa
39 import qmk.cli # noqa
40
41 # Execute
42 return_code = milc.cli()
43
44 if return_code is False:
45 exit(1)
46
47 elif return_code is not True and isinstance(return_code, int):
48 if return_code < 0 or return_code > 255:
49 milc.cli.log.error('Invalid return_code: %d', return_code)
50 exit(255)
51
52 exit(return_code)
53
54 exit(0)
55
56
57if __name__ == '__main__':
58 main()
diff --git a/docs/contributing.md b/docs/contributing.md
index 1d68d22d9..eb033d167 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -105,7 +105,7 @@ enum my_keycodes {
105 105
106Before opening a pull request, you can preview your changes if you have set up the development environment by running this command from the `qmk_firmware/` folder: 106Before opening a pull request, you can preview your changes if you have set up the development environment by running this command from the `qmk_firmware/` folder:
107 107
108 ./bin/qmk docs 108 qmk docs
109 109
110or if you only have Python 3 installed: 110or if you only have Python 3 installed:
111 111
diff --git a/docs/de/cli.md b/docs/de/cli.md
index 7dc02d505..259aeecf7 100644
--- a/docs/de/cli.md
+++ b/docs/de/cli.md
@@ -51,25 +51,6 @@ Wir suchen nach Freiwilligen, die ein `qmk`-Package für weitere Betriebssysteme
51* Installiere mit einem [virtualenv](https://virtualenv.pypa.io/en/latest/). 51* Installiere mit einem [virtualenv](https://virtualenv.pypa.io/en/latest/).
52* Weise den User an, die Umgebungs-Variable `QMK_HOME` zu setzen, um die Firmware-Quelle anders einzustellen als `~/qmk_firmware`. 52* Weise den User an, die Umgebungs-Variable `QMK_HOME` zu setzen, um die Firmware-Quelle anders einzustellen als `~/qmk_firmware`.
53 53
54# Lokale CLI
55
56Wenn Du die globale CLI nicht verwenden möchtest, beinhaltet `qmk_firmware` auch eine lokale CLI. Du kannst sie hier finden: `qmk_firmware/bin/qmk`. Du kannst den `qmk`-Befehl aus irgendeinem Datei-Verzeichnis ausführen und es wird immer auf dieser Kopie von `qmk_firmware` arbeiten.
57
58**Beispiel**:
59
60```
61$ ~/qmk_firmware/bin/qmk hello
62Ψ Hello, World!
63```
64
65## Einschränkungen der lokalen CLI
66
67Hier ein Vergleich mit der globalen CLI:
68
69* Die lokale CLI unterstützt kein `qmk setup` oder `qmk clone`.
70* Die lokale CLI arbeitet immer innerhalb der selben `qmk_firmware`-Verzeichnisstruktur, auch wenn Du mehrere Repositories geklont hast.
71* Die lokale CLI läuft nicht in einer virtualenv. Daher ist es möglich, dass Abhängigkeiten (dependencies) miteinander in Konflikt kommen/stehen.
72
73# CLI-Befehle 54# CLI-Befehle
74 55
75## `qmk compile` 56## `qmk compile`
diff --git a/docs/fr-fr/cli.md b/docs/fr-fr/cli.md
index bfa060f2a..917a9315b 100644
--- a/docs/fr-fr/cli.md
+++ b/docs/fr-fr/cli.md
@@ -48,25 +48,6 @@ Nous recherchons des gens pour créer et maintenir un paquet `qmk` pour plus de
48* Installez en utilisant un virtualenv 48* Installez en utilisant un virtualenv
49* Expliquez à l'utilisateur de définir la variable d'environnement `QMK_Home` pour "check out" les sources du firmware à un autre endroit que `~/qmk_firmware`. 49* Expliquez à l'utilisateur de définir la variable d'environnement `QMK_Home` pour "check out" les sources du firmware à un autre endroit que `~/qmk_firmware`.
50 50
51# CLI locale
52
53Si vous ne voulez pas utiliser la CLI globale, il y a une CLI locale empaquetée avec `qmk_firmware`. Vous pouvez le trouver dans `qmk_firmware/bin/qmk`. Vous pouvez lancer la commande `qmk` depuis n'importe quel répertoire et elle fonctionnera toujours sur cette copie de `qmk_firmware`.
54
55**Exemple**:
56
57```
58$ ~/qmk_firmware/bin/qmk hello
59Ψ Hello, World!
60```
61
62## Limitations de la CLI locale
63
64Il y a quelques limitations à la CLI locale comparé à la globale:
65
66* La CLI locale ne supporte pas `qmk setup` ou `qmk clone`
67* La CLI locale n'opère pas sur le même arbre `qmk_firmware`, même si vous avez plusieurs dépôts clonés.
68* La CLI locale ne s'exécute pas dans un virtualenv, donc il y a des risques que des dépendances seront en conflit
69
70# Les commandes CLI 51# Les commandes CLI
71 52
72## `qmk compile` 53## `qmk compile`
diff --git a/keyboards/dztech/dz65rgb/keymaps/jumper149/readme.md b/keyboards/dztech/dz65rgb/keymaps/jumper149/readme.md
index d87258731..9de86be2d 100644
--- a/keyboards/dztech/dz65rgb/keymaps/jumper149/readme.md
+++ b/keyboards/dztech/dz65rgb/keymaps/jumper149/readme.md
@@ -3,13 +3,13 @@
3Run commands in the root directory of this repository. 3Run commands in the root directory of this repository.
4 4
5``` 5```
6./bin/qmk compile && sudo dfu-programmer atmega32u4 erase && sudo dfu-programmer atmega32u4 flash ./dztech_dz65rgb_v2_jumper149.hex && sudo dfu-programmer atmega32u4 reset 6qmk compile && sudo dfu-programmer atmega32u4 erase && sudo dfu-programmer atmega32u4 flash ./dztech_dz65rgb_v2_jumper149.hex && sudo dfu-programmer atmega32u4 reset
7``` 7```
8 8
9## build 9## build
10 10
11``` 11```
12./bin/qmk compile 12qmk compile
13``` 13```
14 14
15## flash 15## flash
diff --git a/lib/python/qmk/cli/doctor/check.py b/lib/python/qmk/cli/doctor/check.py
index 0807f4151..2d691b64b 100644
--- a/lib/python/qmk/cli/doctor/check.py
+++ b/lib/python/qmk/cli/doctor/check.py
@@ -26,7 +26,6 @@ ESSENTIAL_BINARIES = {
26 'arm-none-eabi-gcc': { 26 'arm-none-eabi-gcc': {
27 'version_arg': '-dumpversion' 27 'version_arg': '-dumpversion'
28 }, 28 },
29 'bin/qmk': {},
30} 29}
31 30
32 31
diff --git a/lib/python/qmk/cli/format/python.py b/lib/python/qmk/cli/format/python.py
index 00612f97e..b32a72640 100755
--- a/lib/python/qmk/cli/format/python.py
+++ b/lib/python/qmk/cli/format/python.py
@@ -11,15 +11,15 @@ def format_python(cli):
11 """Format python code according to QMK's style. 11 """Format python code according to QMK's style.
12 """ 12 """
13 edit = '--diff' if cli.args.dry_run else '--in-place' 13 edit = '--diff' if cli.args.dry_run else '--in-place'
14 yapf_cmd = ['yapf', '-vv', '--recursive', edit, 'bin/qmk', 'lib/python'] 14 yapf_cmd = ['yapf', '-vv', '--recursive', edit, 'lib/python']
15 try: 15 try:
16 cli.run(yapf_cmd, check=True, capture_output=False, stdin=DEVNULL) 16 cli.run(yapf_cmd, check=True, capture_output=False, stdin=DEVNULL)
17 cli.log.info('Python code in `bin/qmk` and `lib/python` is correctly formatted.') 17 cli.log.info('Python code in `lib/python` is correctly formatted.')
18 return True 18 return True
19 19
20 except CalledProcessError: 20 except CalledProcessError:
21 if cli.args.dry_run: 21 if cli.args.dry_run:
22 cli.log.error('Python code in `bin/qmk` and `lib/python` incorrectly formatted!') 22 cli.log.error('Python code in `lib/python` is incorrectly formatted!')
23 else: 23 else:
24 cli.log.error('Error formatting python code!') 24 cli.log.error('Error formatting python code!')
25 25
diff --git a/lib/python/qmk/cli/pytest.py b/lib/python/qmk/cli/pytest.py
index bdb336b9a..a7f01a872 100644
--- a/lib/python/qmk/cli/pytest.py
+++ b/lib/python/qmk/cli/pytest.py
@@ -12,6 +12,6 @@ def pytest(cli):
12 """Run several linting/testing commands. 12 """Run several linting/testing commands.
13 """ 13 """
14 nose2 = cli.run(['nose2', '-v'], capture_output=False, stdin=DEVNULL) 14 nose2 = cli.run(['nose2', '-v'], capture_output=False, stdin=DEVNULL)
15 flake8 = cli.run(['flake8', 'lib/python', 'bin/qmk'], capture_output=False, stdin=DEVNULL) 15 flake8 = cli.run(['flake8', 'lib/python'], capture_output=False, stdin=DEVNULL)
16 16
17 return flake8.returncode | nose2.returncode 17 return flake8.returncode | nose2.returncode
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index 421453d83..01c23b261 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -233,7 +233,7 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va
233 f'VERBOSE={verbose}', 233 f'VERBOSE={verbose}',
234 f'COLOR={color}', 234 f'COLOR={color}',
235 'SILENT=false', 235 'SILENT=false',
236 f'QMK_BIN={"bin/qmk" if "DEPRECATED_BIN_QMK" in os.environ else "qmk"}', 236 'QMK_BIN="qmk"',
237 ]) 237 ])
238 238
239 return make_command 239 return make_command
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py
index b39fe5e46..e4eaef899 100644
--- a/lib/python/qmk/tests/test_cli_commands.py
+++ b/lib/python/qmk/tests/test_cli_commands.py
@@ -83,7 +83,7 @@ def test_hello():
83def test_format_python(): 83def test_format_python():
84 result = check_subcommand('format-python', '--dry-run') 84 result = check_subcommand('format-python', '--dry-run')
85 check_returncode(result) 85 check_returncode(result)
86 assert 'Python code in `bin/qmk` and `lib/python` is correctly formatted.' in result.stdout 86 assert 'Python code in `lib/python` is correctly formatted.' in result.stdout
87 87
88 88
89def test_list_keyboards(): 89def test_list_keyboards():
diff --git a/shell.nix b/shell.nix
index c36df032d..5023a3b0f 100644
--- a/shell.nix
+++ b/shell.nix
@@ -14,7 +14,7 @@ let
14 projectDir = ./util/nix; 14 projectDir = ./util/nix;
15 overrides = poetry2nix.overrides.withDefaults (self: super: { 15 overrides = poetry2nix.overrides.withDefaults (self: super: {
16 qmk = super.qmk.overridePythonAttrs(old: { 16 qmk = super.qmk.overridePythonAttrs(old: {
17 # Allow QMK CLI to run "bin/qmk" as a subprocess (the wrapper changes 17 # Allow QMK CLI to run "qmk" as a subprocess (the wrapper changes
18 # $PATH and breaks these invocations). 18 # $PATH and breaks these invocations).
19 dontWrapPythonPrograms = true; 19 dontWrapPythonPrograms = true;
20 }); 20 });