From 0e17edace1b2e9dab76fecf00975e4ae5c83c46d Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Sun, 4 Jun 2023 20:45:17 +0200 Subject: [PATCH] host: improve Windows EXE build generation A virtual environment is now created and used to generate the EXE build, which helps to keep its size down to ~10 MiB. --- .gitignore | 1 + host/windows_make_standalone.bat | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2c5357a..61e2b77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .vscode build host/__pycache__ +host/installer host/build host/dist host/nxdumptool diff --git a/host/windows_make_standalone.bat b/host/windows_make_standalone.bat index f1a6646..02d44f9 100644 --- a/host/windows_make_standalone.bat +++ b/host/windows_make_standalone.bat @@ -1,8 +1,28 @@ -pyinstaller -y --clean --log-level WARN -F --add-binary "C:\Windows\System32\libusb0.dll;." -w -i nxdt.ico nxdt_host.py +@echo off + +set scriptdir=%~dp0 +set scriptdir=%scriptdir:~0,-1% + +set venvname=installer +set venvscripts=%scriptdir%\%venvname%\Scripts + +set venvpython=%venvscripts%\python.exe +set venvpyinstaller=%venvscripts%\pyinstaller.exe + +cd /D "%scriptdir%" + +python -m venv "%venvname%" + +"%venvpython%" -m pip install --upgrade pyinstaller -r requirements-win32.txt + +"%venvpyinstaller%" -y --clean --log-level WARN -F --add-binary "C:\Windows\System32\libusb0.dll;." -w -i nxdt.ico nxdt_host.py move dist\nxdt_host.exe nxdt_host.exe rmdir /s /q __pycache__ rmdir /s /q build rmdir /s /q dist +rmdir /s /q installer del nxdt_host.spec + +pause