From ddd0f54c94e6b354dc2059bf37dffea53caf5573 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Wed, 19 Mar 2025 12:12:38 +1100 Subject: [PATCH] Hook up internals of the `qmk` CLI to use `$QMK_DISTRIB_DIR`. --- lib/python/qmk/cli/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py index 3f2ba9ce3cc..07959f0bd3e 100644 --- a/lib/python/qmk/cli/__init__.py +++ b/lib/python/qmk/cli/__init__.py @@ -12,6 +12,11 @@ from subprocess import run from milc import cli, __VERSION__ from milc.questions import yesno +# Ensure the QMK distribution is on the `$PATH` if present. +QMK_DISTRIB_DIR = Path(os.environ.get('QMK_DISTRIB_DIR', os.path.expanduser('~/.local/qmk/distrib'))) # the expansion must be kept in sync with `util/env-bootstrap.sh`! +if QMK_DISTRIB_DIR.exists(): + os.environ['PATH'] = str(QMK_DISTRIB_DIR / 'bin') + os.pathsep + os.environ['PATH'] + import_names = { # A mapping of package name to importable name 'pep8-naming': 'pep8ext_naming',