Skip to content

Commit 5830c14

Browse files
committed
feat(build): cross-platform build-and-install with Windows shell integration
Add scripts/build_and_install.py as the shared macOS/Windows entry point with PyInstaller build and platform-default install. Register Windows installs via Start Menu shortcut, Apps and Features uninstall key, and an uninstall script. Require explicit MOUSER_SIGN_IDENTITY or MOUSER_TEAM_ID for macOS signing with no hardcoded team defaults. Fix packaged QML on Windows (pageHost layout, ScrollView sizing, Qt plugin paths, QML warning logs). Add unit tests that pass on Linux CI.
1 parent 44880fb commit 5830c14

11 files changed

Lines changed: 965 additions & 9 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ build/
1313
*.egg
1414

1515
# IDE
16-
.vscode/
1716
.idea/
1817
.cursor/
1918
*.swp
@@ -37,5 +36,8 @@ Desktop.ini
3736
# Build artifacts
3837
build_icon.py
3938

39+
# Local diagnostics (machine-specific install paths)
40+
tools/probe_frozen_qml.py
41+
4042
# Shortcuts (user-specific paths)
4143
*.lnk

.vscode/tasks.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Build Mouser and Install",
6+
"type": "shell",
7+
"windows": {
8+
"command": "python",
9+
"args": ["${workspaceFolder}/scripts/build_and_install.py"]
10+
},
11+
"osx": {
12+
"command": "python3",
13+
"args": ["${workspaceFolder}/scripts/build_and_install.py"]
14+
},
15+
"linux": {
16+
"command": "python3",
17+
"args": ["${workspaceFolder}/scripts/build_and_install.py"]
18+
},
19+
"group": {
20+
"kind": "build",
21+
"isDefault": true
22+
},
23+
"presentation": {
24+
"reveal": "always",
25+
"panel": "shared",
26+
"focus": true,
27+
"clear": true
28+
},
29+
"problemMatcher": []
30+
}
31+
]
32+
}

main_qml.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ def _resolve_root_dir():
5858
# Ensure PySide6 QML plugins are found
5959
import PySide6
6060
_pyside_dir = os.path.dirname(PySide6.__file__)
61-
os.environ.setdefault("QML2_IMPORT_PATH", os.path.join(_pyside_dir, "qml"))
62-
os.environ.setdefault("QT_PLUGIN_PATH", os.path.join(_pyside_dir, "plugins"))
61+
_qml_dir = os.path.join(_pyside_dir, "qml")
62+
_plugin_dir = os.path.join(_pyside_dir, "plugins")
63+
os.environ.setdefault("QML2_IMPORT_PATH", _qml_dir)
64+
os.environ.setdefault("QT_PLUGIN_PATH", _plugin_dir)
65+
QCoreApplication.addLibraryPath(_plugin_dir)
66+
QCoreApplication.addLibraryPath(_qml_dir)
6367

6468
_t3 = _time.perf_counter()
6569
from core.config import load_config, save_config
@@ -1018,6 +1022,12 @@ def _dump_threads(sig, frame):
10181022

10191023
# ── QML Engine ─────────────────────────────────────────────
10201024
qml_engine = QQmlApplicationEngine()
1025+
1026+
def _log_qml_warnings(warnings):
1027+
for warning in warnings:
1028+
print(f"[QML] {warning.toString()}")
1029+
1030+
qml_engine.warnings.connect(_log_qml_warnings)
10211031
qml_engine.addImageProvider("appicons", AppIconProvider(ROOT))
10221032
qml_engine.addImageProvider("systemicons", SystemIconProvider())
10231033
qml_engine.rootContext().setContextProperty("backend", backend)

scripts/build_and_install.bat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@echo off
2+
setlocal
3+
cd /d "%~dp0\.."
4+
python "%~dp0build_and_install.py"
5+
if errorlevel 1 exit /b 1

0 commit comments

Comments
 (0)