mirror of
https://github.com/qmk/qmk_firmware
synced 2024-12-22 08:26:21 +00:00
Remove bin/qmk (#14231)
* Remove the bin/qmk script * remove bin/qmk from workflows
This commit is contained in:
parent
b46064a891
commit
596c4a1f87
1
.github/labeler.yml
vendored
1
.github/labeler.yml
vendored
@ -22,7 +22,6 @@ keymap:
|
||||
via:
|
||||
- keyboards/**/keymaps/via/*
|
||||
cli:
|
||||
- bin/qmk
|
||||
- requirements.txt
|
||||
- lib/python/**/*
|
||||
python:
|
||||
|
1
.github/workflows/cli.yml
vendored
1
.github/workflows/cli.yml
vendored
@ -8,7 +8,6 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'lib/python/**'
|
||||
- 'bin/qmk'
|
||||
- 'requirements.txt'
|
||||
- '.github/workflows/cli.yml'
|
||||
|
||||
|
6
Makefile
6
Makefile
@ -30,11 +30,7 @@ endif
|
||||
endif
|
||||
|
||||
# Determine which qmk cli to use
|
||||
ifeq (,$(shell which qmk))
|
||||
QMK_BIN = bin/qmk
|
||||
else
|
||||
QMK_BIN = qmk
|
||||
endif
|
||||
QMK_BIN := qmk
|
||||
|
||||
# avoid 'Entering|Leaving directory' messages
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
58
bin/qmk
58
bin/qmk
@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""CLI wrapper for running QMK commands.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add the QMK python libs to our path
|
||||
script_dir = Path(os.path.realpath(__file__)).parent
|
||||
qmk_dir = script_dir.parent
|
||||
python_lib_dir = Path(qmk_dir / 'lib' / 'python').resolve()
|
||||
sys.path.append(str(python_lib_dir))
|
||||
|
||||
# Setup the CLI
|
||||
import milc # noqa
|
||||
|
||||
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
|
||||
|
||||
|
||||
@milc.cli.entrypoint('QMK Helper Script')
|
||||
def qmk_main(cli):
|
||||
"""The function that gets run when no subcommand is provided.
|
||||
"""
|
||||
cli.print_help()
|
||||
|
||||
|
||||
def main():
|
||||
"""Setup our environment and then call the CLI entrypoint.
|
||||
"""
|
||||
# Change to the root of our checkout
|
||||
os.environ['ORIG_CWD'] = os.getcwd()
|
||||
os.environ['DEPRECATED_BIN_QMK'] = '1'
|
||||
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 milc.subcommand.config # noqa
|
||||
import qmk.cli # noqa
|
||||
|
||||
# Execute
|
||||
return_code = milc.cli()
|
||||
|
||||
if return_code is False:
|
||||
exit(1)
|
||||
|
||||
elif return_code is not True and isinstance(return_code, int):
|
||||
if return_code < 0 or return_code > 255:
|
||||
milc.cli.log.error('Invalid return_code: %d', return_code)
|
||||
exit(255)
|
||||
|
||||
exit(return_code)
|
||||
|
||||
exit(0)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -105,7 +105,7 @@ enum my_keycodes {
|
||||
|
||||
Before 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:
|
||||
|
||||
./bin/qmk docs
|
||||
qmk docs
|
||||
|
||||
or if you only have Python 3 installed:
|
||||
|
||||
|
@ -51,25 +51,6 @@ Wir suchen nach Freiwilligen, die ein `qmk`-Package für weitere Betriebssysteme
|
||||
* Installiere mit einem [virtualenv](https://virtualenv.pypa.io/en/latest/).
|
||||
* Weise den User an, die Umgebungs-Variable `QMK_HOME` zu setzen, um die Firmware-Quelle anders einzustellen als `~/qmk_firmware`.
|
||||
|
||||
# Lokale CLI
|
||||
|
||||
Wenn 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.
|
||||
|
||||
**Beispiel**:
|
||||
|
||||
```
|
||||
$ ~/qmk_firmware/bin/qmk hello
|
||||
Ψ Hello, World!
|
||||
```
|
||||
|
||||
## Einschränkungen der lokalen CLI
|
||||
|
||||
Hier ein Vergleich mit der globalen CLI:
|
||||
|
||||
* Die lokale CLI unterstützt kein `qmk setup` oder `qmk clone`.
|
||||
* Die lokale CLI arbeitet immer innerhalb der selben `qmk_firmware`-Verzeichnisstruktur, auch wenn Du mehrere Repositories geklont hast.
|
||||
* Die lokale CLI läuft nicht in einer virtualenv. Daher ist es möglich, dass Abhängigkeiten (dependencies) miteinander in Konflikt kommen/stehen.
|
||||
|
||||
# CLI-Befehle
|
||||
|
||||
## `qmk compile`
|
||||
|
@ -48,25 +48,6 @@ Nous recherchons des gens pour créer et maintenir un paquet `qmk` pour plus de
|
||||
* Installez en utilisant un virtualenv
|
||||
* 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`.
|
||||
|
||||
# CLI locale
|
||||
|
||||
Si 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`.
|
||||
|
||||
**Exemple**:
|
||||
|
||||
```
|
||||
$ ~/qmk_firmware/bin/qmk hello
|
||||
Ψ Hello, World!
|
||||
```
|
||||
|
||||
## Limitations de la CLI locale
|
||||
|
||||
Il y a quelques limitations à la CLI locale comparé à la globale:
|
||||
|
||||
* La CLI locale ne supporte pas `qmk setup` ou `qmk clone`
|
||||
* 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.
|
||||
* La CLI locale ne s'exécute pas dans un virtualenv, donc il y a des risques que des dépendances seront en conflit
|
||||
|
||||
# Les commandes CLI
|
||||
|
||||
## `qmk compile`
|
||||
|
@ -3,13 +3,13 @@
|
||||
Run commands in the root directory of this repository.
|
||||
|
||||
```
|
||||
./bin/qmk compile && sudo dfu-programmer atmega32u4 erase && sudo dfu-programmer atmega32u4 flash ./dztech_dz65rgb_v2_jumper149.hex && sudo dfu-programmer atmega32u4 reset
|
||||
qmk compile && sudo dfu-programmer atmega32u4 erase && sudo dfu-programmer atmega32u4 flash ./dztech_dz65rgb_v2_jumper149.hex && sudo dfu-programmer atmega32u4 reset
|
||||
```
|
||||
|
||||
## build
|
||||
|
||||
```
|
||||
./bin/qmk compile
|
||||
qmk compile
|
||||
```
|
||||
|
||||
## flash
|
||||
|
@ -26,7 +26,6 @@ ESSENTIAL_BINARIES = {
|
||||
'arm-none-eabi-gcc': {
|
||||
'version_arg': '-dumpversion'
|
||||
},
|
||||
'bin/qmk': {},
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,15 +11,15 @@ def format_python(cli):
|
||||
"""Format python code according to QMK's style.
|
||||
"""
|
||||
edit = '--diff' if cli.args.dry_run else '--in-place'
|
||||
yapf_cmd = ['yapf', '-vv', '--recursive', edit, 'bin/qmk', 'lib/python']
|
||||
yapf_cmd = ['yapf', '-vv', '--recursive', edit, 'lib/python']
|
||||
try:
|
||||
cli.run(yapf_cmd, check=True, capture_output=False, stdin=DEVNULL)
|
||||
cli.log.info('Python code in `bin/qmk` and `lib/python` is correctly formatted.')
|
||||
cli.log.info('Python code in `lib/python` is correctly formatted.')
|
||||
return True
|
||||
|
||||
except CalledProcessError:
|
||||
if cli.args.dry_run:
|
||||
cli.log.error('Python code in `bin/qmk` and `lib/python` incorrectly formatted!')
|
||||
cli.log.error('Python code in `lib/python` is incorrectly formatted!')
|
||||
else:
|
||||
cli.log.error('Error formatting python code!')
|
||||
|
||||
|
@ -12,6 +12,6 @@ def pytest(cli):
|
||||
"""Run several linting/testing commands.
|
||||
"""
|
||||
nose2 = cli.run(['nose2', '-v'], capture_output=False, stdin=DEVNULL)
|
||||
flake8 = cli.run(['flake8', 'lib/python', 'bin/qmk'], capture_output=False, stdin=DEVNULL)
|
||||
flake8 = cli.run(['flake8', 'lib/python'], capture_output=False, stdin=DEVNULL)
|
||||
|
||||
return flake8.returncode | nose2.returncode
|
||||
|
@ -233,7 +233,7 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va
|
||||
f'VERBOSE={verbose}',
|
||||
f'COLOR={color}',
|
||||
'SILENT=false',
|
||||
f'QMK_BIN={"bin/qmk" if "DEPRECATED_BIN_QMK" in os.environ else "qmk"}',
|
||||
'QMK_BIN="qmk"',
|
||||
])
|
||||
|
||||
return make_command
|
||||
|
@ -83,7 +83,7 @@ def test_hello():
|
||||
def test_format_python():
|
||||
result = check_subcommand('format-python', '--dry-run')
|
||||
check_returncode(result)
|
||||
assert 'Python code in `bin/qmk` and `lib/python` is correctly formatted.' in result.stdout
|
||||
assert 'Python code in `lib/python` is correctly formatted.' in result.stdout
|
||||
|
||||
|
||||
def test_list_keyboards():
|
||||
|
@ -14,7 +14,7 @@ let
|
||||
projectDir = ./util/nix;
|
||||
overrides = poetry2nix.overrides.withDefaults (self: super: {
|
||||
qmk = super.qmk.overridePythonAttrs(old: {
|
||||
# Allow QMK CLI to run "bin/qmk" as a subprocess (the wrapper changes
|
||||
# Allow QMK CLI to run "qmk" as a subprocess (the wrapper changes
|
||||
# $PATH and breaks these invocations).
|
||||
dontWrapPythonPrograms = true;
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user