2.6 KiB
2.6 KiB
Packaging the Backup Client (PyInstaller flow)
This guide explains how to transform the PySide6 UI into BackupClient.exe, bundle the portable configuration, scheduler helpers, and ship-ready assets.
1. Pre-requisites
- Install Python 3.10+ on the Windows build machine.
- Create a virtual environment inside
/path/to/projbck/clientand activate it. - Install the Python dependencies with
pip install -e .to grab PySide6, requests, python-dotenv, and PyInstaller. - Ensure OpenSSH/rsync/sshpass and the scheduler PowerShell helper already exist inside the client directory (
scheduler/manage_scheduler.ps1,config.json).
2. Building the executable
- Open
cmd.exeor PowerShell (elevated if you need scheduler permissions). - Navigate to the project root:
cd \path\to\projbck. - Run the provided helper script:
client\package_client.bat. It will:- Invoke PyInstaller with
--onefile, addingconfig.jsonto the exe root and theschedulerfolder under the same directory. - Expect PyInstaller to create
client\dist\BackupClient. - Call
client\post_build.bat dist\BackupClientto copyconfig.jsonand theschedulerfolder explicitly (in case PyInstaller didn’t preserve them) next toBackupClient.exe.
- Invoke PyInstaller with
- Alternatively, if you prefer Bash/WSL,
./client/package_client.shperforms the same operations.
3. What travels with the exe
The dist\BackupClient directory after running the helper will contain:
BackupClient.exe: the packaged PySide6 client.config.json: portable configuration storing server URL, profiles, scheduler flag, and API token state.scheduler\manage_scheduler.ps1: PowerShell helper that creates/removes the Task Scheduler task when the checkbox is toggled.
4. Post-build validation
- Confirm
BackupClient.exefindsconfig.jsonnext to it; this file must remain writable for the UI to save profiles. - Ensure
scheduler/manage_scheduler.ps1exists relative to the executable atscheduler/manage_scheduler.ps1so the scheduler toggle can invoke it. - Run
BackupClient.exeto verify the UI opens, loads the config, andEsegui backupworks. - Toggle the scheduler checkbox to confirm PowerShell can find and execute
manage_scheduler.ps1(it will create a task such asBackupClient-<profilo>under Task Scheduler).
5. Deployment
Package the entire dist\BackupClient folder. The deployment artifact must keep:
BackupClient.execonfig.jsonscheduler\manage_scheduler.ps1- Any optional assets you add later (icons, documentation, etc.)
If you automate releases, call client\package_client.bat inside your CI/CD script and archive the resulting dist\BackupClient directory.