Remove bin/qmk (#14231)

* Remove the bin/qmk script

* remove bin/qmk from workflows
master
Zach White 2021-08-29 16:50:22 -07:00 committed by GitHub
parent b46064a891
commit 596c4a1f87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 11 additions and 114 deletions

1
.github/labeler.yml vendored
View File

@ -22,7 +22,6 @@ keymap:
via: via:
- keyboards/**/keymaps/via/* - keyboards/**/keymaps/via/*
cli: cli:
- bin/qmk
- requirements.txt - requirements.txt
- lib/python/**/* - lib/python/**/*
python: python:

View File

@ -8,7 +8,6 @@ on:
pull_request: pull_request:
paths: paths:
- 'lib/python/**' - 'lib/python/**'
- 'bin/qmk'
- 'requirements.txt' - 'requirements.txt'
- '.github/workflows/cli.yml' - '.github/workflows/cli.yml'

View File

@ -30,11 +30,7 @@ endif
endif endif
# Determine which qmk cli to use # Determine which qmk cli to use
ifeq (,$(shell which qmk)) QMK_BIN := 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

58
bin/qmk
View File

@ -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()

View File

@ -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: 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: or if you only have Python 3 installed:

View File

@ -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/). * 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`. * 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 # CLI-Befehle
## `qmk compile` ## `qmk compile`

View File

@ -48,25 +48,6 @@ Nous recherchons des gens pour créer et maintenir un paquet `qmk` pour plus de
* Installez en utilisant un virtualenv * 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`. * 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 # Les commandes CLI
## `qmk compile` ## `qmk compile`

View File

@ -3,13 +3,13 @@
Run commands in the root directory of this repository. 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 ## build
``` ```
./bin/qmk compile qmk compile
``` ```
## flash ## flash

View File

@ -26,7 +26,6 @@ ESSENTIAL_BINARIES = {
'arm-none-eabi-gcc': { 'arm-none-eabi-gcc': {
'version_arg': '-dumpversion' 'version_arg': '-dumpversion'
}, },
'bin/qmk': {},
} }

View File

@ -11,15 +11,15 @@ def format_python(cli):
"""Format python code according to QMK's style. """Format python code according to QMK's style.
""" """
edit = '--diff' if cli.args.dry_run else '--in-place' 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: try:
cli.run(yapf_cmd, check=True, capture_output=False, stdin=DEVNULL) 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 return True
except CalledProcessError: except CalledProcessError:
if cli.args.dry_run: 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: else:
cli.log.error('Error formatting python code!') cli.log.error('Error formatting python code!')

View File

@ -12,6 +12,6 @@ def pytest(cli):
"""Run several linting/testing commands. """Run several linting/testing commands.
""" """
nose2 = cli.run(['nose2', '-v'], capture_output=False, stdin=DEVNULL) 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 return flake8.returncode | nose2.returncode

View File

@ -233,7 +233,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',
f'QMK_BIN={"bin/qmk" if "DEPRECATED_BIN_QMK" in os.environ else "qmk"}', 'QMK_BIN="qmk"',
]) ])
return make_command return make_command

View File

@ -83,7 +83,7 @@ def test_hello():
def test_format_python(): def test_format_python():
result = check_subcommand('format-python', '--dry-run') result = check_subcommand('format-python', '--dry-run')
check_returncode(result) 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(): def test_list_keyboards():

View File

@ -14,7 +14,7 @@ let
projectDir = ./util/nix; projectDir = ./util/nix;
overrides = poetry2nix.overrides.withDefaults (self: super: { overrides = poetry2nix.overrides.withDefaults (self: super: {
qmk = super.qmk.overridePythonAttrs(old: { 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). # $PATH and breaks these invocations).
dontWrapPythonPrograms = true; dontWrapPythonPrograms = true;
}); });