mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-27 11:31:13 +00:00
Distribution path.
This commit is contained in:
parent
99f2b767be
commit
ad8c332b59
@ -3,6 +3,8 @@
|
|||||||
We list each subcommand here explicitly because all the reliable ways of searching for modules are slow and delay startup.
|
We list each subcommand here explicitly because all the reliable ways of searching for modules are slow and delay startup.
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
|
import platformdirs
|
||||||
import shlex
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
from importlib.util import find_spec
|
from importlib.util import find_spec
|
||||||
@ -13,7 +15,8 @@ from milc import cli, __VERSION__
|
|||||||
from milc.questions import yesno
|
from milc.questions import yesno
|
||||||
|
|
||||||
# Ensure the QMK distribution is on the `$PATH` if present.
|
# 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():
|
if QMK_DISTRIB_DIR.exists():
|
||||||
os.environ['PATH'] = str(QMK_DISTRIB_DIR / 'bin') + os.pathsep + os.environ['PATH']
|
os.environ['PATH'] = str(QMK_DISTRIB_DIR / 'bin') + os.pathsep + os.environ['PATH']
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ set -eu
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Configurables:
|
# Configurables:
|
||||||
# QMK_DISTRIB_DIR: The directory to install the QMK distribution to.
|
# QMK_DISTRIB_DIR: The directory to install the QMK distribution to.
|
||||||
# UV_INSTALL_DIR: The directory to install `uv` to. This will be ignored on QMK MSYS, installing into `/opt/uv` instead.
|
# UV_INSTALL_DIR: The directory to install `uv` to.
|
||||||
# SKIP_CLEAN: Skip cleaning the distribution directory.
|
# SKIP_CLEAN: Skip cleaning the distribution directory.
|
||||||
# SKIP_UV: Skip installing `uv`.
|
# SKIP_UV: Skip installing `uv`.
|
||||||
# SKIP_QMK_CLI: Skip installing the QMK CLI.
|
# SKIP_QMK_CLI: Skip installing the QMK CLI.
|
||||||
@ -24,8 +24,16 @@ set -eu
|
|||||||
# Any other configurable items listed above may be specified in the same way.
|
# Any other configurable items listed above may be specified in the same way.
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# Windows/MSYS doesn't like `/tmp` so we need to set a different temporary directory.
|
||||||
|
# Also set the default `UV_INSTALL_DIR` and `QMK_DISTRIB_DIR` to locations which don't pollute the user's home directory, keeping the installation internal to MSYS.
|
||||||
|
if [ "$(uname -o 2>/dev/null || true)" = "Msys" ]; then
|
||||||
|
export TMPDIR="$(cygpath -w "$TMP")"
|
||||||
|
export UV_INSTALL_DIR=${UV_INSTALL_DIR:-/opt/uv}
|
||||||
|
export QMK_DISTRIB_DIR=${QMK_DISTRIB_DIR:-/opt/qmk}
|
||||||
|
fi
|
||||||
|
|
||||||
# Work out where we want to install the distribution
|
# Work out where we want to install the distribution
|
||||||
QMK_DISTRIB_DIR=${QMK_DISTRIB_DIR:-$HOME/.local/qmk/distrib}
|
export QMK_DISTRIB_DIR=${QMK_DISTRIB_DIR:-$HOME/.local/share/qmk}
|
||||||
# Clear out the target directory if necessary
|
# Clear out the target directory if necessary
|
||||||
if [ -z "${SKIP_CLEAN:-}" ] || [ -z "${SKIP_QMK_TOOLCHAINS:-}" -a -z "${SKIP_QMK_FLASHUTILS:-}" ]; then
|
if [ -z "${SKIP_CLEAN:-}" ] || [ -z "${SKIP_QMK_TOOLCHAINS:-}" -a -z "${SKIP_QMK_FLASHUTILS:-}" ]; then
|
||||||
if [ -d "$QMK_DISTRIB_DIR" ]; then
|
if [ -d "$QMK_DISTRIB_DIR" ]; then
|
||||||
@ -35,14 +43,6 @@ if [ -z "${SKIP_CLEAN:-}" ] || [ -z "${SKIP_QMK_TOOLCHAINS:-}" -a -z "${SKIP_QMK
|
|||||||
fi
|
fi
|
||||||
mkdir -p "$QMK_DISTRIB_DIR"
|
mkdir -p "$QMK_DISTRIB_DIR"
|
||||||
|
|
||||||
# Windows doesn't like `/tmp` so we need to set a different temporary directory
|
|
||||||
# and also set the `UV_INSTALL_DIR` to a location that doesn't pollute the user's
|
|
||||||
# home directory.
|
|
||||||
if [ "$(uname -o 2>/dev/null || true)" = "Msys" ]; then
|
|
||||||
export TMPDIR="$(cygpath -w "$TMP")"
|
|
||||||
export UV_INSTALL_DIR=/opt/uv
|
|
||||||
fi
|
|
||||||
|
|
||||||
download_url() {
|
download_url() {
|
||||||
local url=$1
|
local url=$1
|
||||||
local filename=${2:-$(basename "$url")}
|
local filename=${2:-$(basename "$url")}
|
||||||
|
Loading…
Reference in New Issue
Block a user