-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.bat
More file actions
74 lines (66 loc) · 2.6 KB
/
build.bat
File metadata and controls
74 lines (66 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
@echo off
:: ──────────────────────────────────────────────────────────────
:: build.bat — Build a portable Mouser distribution
::
:: Produces: dist\Mouser\Mouser.exe (+ supporting files)
:: Zip that folder and distribute — no Python install required.
::
:: Usage: build.bat — incremental (fast, reuses cache)
:: build.bat --clean — full clean rebuild
:: ──────────────────────────────────────────────────────────────
title Mouser — Build
cd /d "%~dp0"
set "START_TIME=%TIME%"
echo.
echo === Mouser Portable Build ===
echo.
:: ── 1. Activate venv if present ──────────────────────────────
if exist ".venv\Scripts\activate.bat" (
call ".venv\Scripts\activate.bat"
echo [*] Virtual-env activated
) else (
echo [!] No .venv found — using system Python
)
:: ── 2. Ensure PyInstaller is installed ───────────────────────
pip show pyinstaller >nul 2>&1
if %errorlevel% neq 0 (
echo [*] Installing PyInstaller...
pip install pyinstaller
)
:: ── 3. Clean previous build ──────────────────────────────────
:: Always clean dist (output); only clean build cache with --clean
if exist "dist\Mouser" (
echo [*] Removing previous dist\Mouser...
rmdir /s /q "dist\Mouser"
)
if /i "%~1"=="--clean" (
if exist "build\Mouser" (
echo [*] Full clean: removing build cache...
rmdir /s /q "build\Mouser"
)
) else (
if exist "build\Mouser" (
echo [*] Incremental build — reusing analysis cache
)
)
:: ── 4. Run PyInstaller ───────────────────────────────────────
echo [*] Building with PyInstaller...
pyinstaller Mouser.spec --noconfirm
if %errorlevel% neq 0 (
echo.
echo [ERROR] Build failed — see messages above.
pause
exit /b 1
)
:: ── 5. Copy default config if missing ────────────────────────
:: (not needed — config is auto-created at first run in %APPDATA%)
set "END_TIME=%TIME%"
echo.
echo === Build complete! ===
echo Output: dist\Mouser\Mouser.exe
echo Started: %START_TIME%
echo Finished: %END_TIME%
echo.
echo To distribute: zip the dist\Mouser folder.
echo.
pause