Distribution path.

This commit is contained in:
Nick Brassel 2025-03-20 23:53:19 +11:00
commit ad8c332b59
No known key found for this signature in database
2 changed files with 14 additions and 11 deletions

View file

@ -3,6 +3,8 @@
We list each subcommand here explicitly because all the reliable ways of searching for modules are slow and delay startup.
"""
import os
import platform
import platformdirs
import shlex
import sys
from importlib.util import find_spec
@ -13,7 +15,8 @@ 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`!
_default_distrib_path = '/opt/qmk' if 'windows' in platform.platform().lower() else platformdirs.user_data_path('qmk') # this must be kept in sync with the default values inside `util/env-bootstrap.sh`!
QMK_DISTRIB_DIR = Path(os.environ.get('QMK_DISTRIB_DIR', _default_distrib_path))
if QMK_DISTRIB_DIR.exists():
os.environ['PATH'] = str(QMK_DISTRIB_DIR / 'bin') + os.pathsep + os.environ['PATH']