1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-14 01:32:29 -04:00

fix(qmllint): Update distro detection logic for qmllint

This commit is contained in:
purian23
2026-03-11 16:22:37 -04:00
parent ded2c38551
commit 76c50a654a
3 changed files with 20 additions and 4 deletions

View File

@@ -86,7 +86,7 @@ touch .qmlls.ini
4. Restart dms to generate the `.qmlls.ini` file 4. Restart dms to generate the `.qmlls.ini` file
5. Run `make lint-qml` from the repo root to lint QML entrypoints (requires the `.qmlls.ini` generated above). The script needs the **Qt 6** `qmllint`; it checks `qmllint6`, `/usr/lib/qt6/bin/qmllint`, then `qmllint` in `PATH`. If your Qt 6 binary lives elsewhere, set `QMLLINT=/path/to/qmllint`. 5. Run `make lint-qml` from the repo root to lint QML entrypoints (requires the `.qmlls.ini` generated above). The script needs the **Qt 6** `qmllint`; it checks `qmllint6`, Fedora's `qmllint-qt6`, `/usr/lib/qt6/bin/qmllint`, then `qmllint` in `PATH`. If your Qt 6 binary lives elsewhere, set `QMLLINT=/path/to/qmllint`.
6. Make your changes, test, and open a pull request. 6. Make your changes, test, and open a pull request.

View File

@@ -29,6 +29,7 @@ quickshell -p quickshell/
qmlfmt -t 4 -i 4 -b 250 -w path/to/file.qml qmlfmt -t 4 -i 4 -b 250 -w path/to/file.qml
make lint-qml # Run from repo root; requires quickshell/.qmlls.ini (generated by `qs -p quickshell/`) make lint-qml # Run from repo root; requires quickshell/.qmlls.ini (generated by `qs -p quickshell/`)
# Uses Qt 6 qmllint. Override path with QMLLINT=/path/to/qmllint if needed. # Uses Qt 6 qmllint. Override path with QMLLINT=/path/to/qmllint if needed.
# Auto-detects `qmllint6`, Fedora's `qmllint-qt6`, `/usr/lib/qt6/bin/qmllint`, then `qmllint`.
``` ```
## Components ## Components

View File

@@ -12,8 +12,8 @@ repo_root="$(
quickshell_dir="${repo_root}/quickshell" quickshell_dir="${repo_root}/quickshell"
qmlls_config="${quickshell_dir}/.qmlls.ini" qmlls_config="${quickshell_dir}/.qmlls.ini"
# Resolve qmllint: honour QMLLINT, then try qmllint6, then the common Qt 6 # Resolve qmllint: honour QMLLINT, then try common Qt 6 binary names and
# install path, and finally bare qmllint. We need the Qt 6 build (>= 6.x) # install paths, and finally bare qmllint. We need the Qt 6 build (>= 6.x)
# because older Qt 5 qmllint doesn't understand --ignore-settings / -W. # because older Qt 5 qmllint doesn't understand --ignore-settings / -W.
resolve_qmllint() { resolve_qmllint() {
if [[ -n "${QMLLINT:-}" ]]; then if [[ -n "${QMLLINT:-}" ]]; then
@@ -21,7 +21,7 @@ resolve_qmllint() {
return return
fi fi
local candidate local candidate
for candidate in qmllint6 /usr/lib/qt6/bin/qmllint qmllint; do for candidate in qmllint6 qmllint-qt6 /usr/lib/qt6/bin/qmllint qmllint; do
if command -v -- "${candidate}" >/dev/null 2>&1; then if command -v -- "${candidate}" >/dev/null 2>&1; then
printf '%s\n' "${candidate}" printf '%s\n' "${candidate}"
return return
@@ -35,6 +35,16 @@ if ! qmllint_bin="$(resolve_qmllint)"; then
exit 127 exit 127
fi fi
print_broken_qmlls_link() {
local target=""
target="$(readlink -- "${qmlls_config}" 2>/dev/null || true)"
printf 'error: %s is a broken symlink. lint-qml requires a live Quickshell tooling VFS.\n' "${qmlls_config}" >&2
if [[ -n "${target}" ]]; then
printf 'Broken target: %s\n' "${target}" >&2
fi
print_vfs_recovery
}
trim_ini_value() { trim_ini_value() {
local value="$1" local value="$1"
value="${value#\"}" value="${value#\"}"
@@ -61,6 +71,11 @@ print_vfs_recovery() {
printf ' qs -p %q\n' "${quickshell_dir}" >&2 printf ' qs -p %q\n' "${quickshell_dir}" >&2
} }
if [[ -L "${qmlls_config}" && ! -e "${qmlls_config}" ]]; then
print_broken_qmlls_link
exit 1
fi
if [[ ! -e "${qmlls_config}" ]]; then if [[ ! -e "${qmlls_config}" ]]; then
printf 'error: %s is missing. lint-qml requires the Quickshell tooling VFS.\n' "${qmlls_config}" >&2 printf 'error: %s is missing. lint-qml requires the Quickshell tooling VFS.\n' "${qmlls_config}" >&2
print_vfs_recovery print_vfs_recovery